Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make parent scope explicit #16819

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

pavelfeldman
Copy link
Member

No description provided.

@@ -62,7 +62,7 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel> im
return;
const params = { url: event.url, name: event.name, error: event.error ? event.error.message : undefined };
if (event.newDocument)
(params as any).newDocument = { request: RequestDispatcher.fromNullable(this._scope, event.newDocument.request || null) };
(params as any).newDocument = { request: RequestDispatcher.fromNullable(scope.parentScope()!, event.newDocument.request || null) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be this._scope now that we put request as a child of frame?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we are building the right scope based on the context scope inside the called method.

super(scope, response, 'Response', {
// TODO: responses in popups can point to non-reported requests.
request: RequestDispatcher.from(scope, response.request()),
request: RequestDispatcher.from(contextScope, response.request()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use scope instead of contextScope?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, check out the called method.

url: request.url(),
resourceType: request.resourceType(),
method: request.method(),
postData: postData === null ? undefined : postData,
headers: request.headers(),
isNavigationRequest: request.isNavigationRequest(),
redirectedFrom: RequestDispatcher.fromNullable(scope, request.redirectedFrom()),
redirectedFrom: RequestDispatcher.fromNullable(contextScope, request.redirectedFrom()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope instead of contextScope here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really...

{ _guid: 'frame', objects: [
{ _guid: 'request', objects: [] },
{ _guid: 'response', objects: [] },
] },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding more objects to this test like JSHandle, Route and Worker would be beneficial.

super(scope, worker, 'Worker', {
url: worker.url()
});
}, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we can declare every object a scope now. Do we have an example where it's not a scope and it matters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be able to do that in a follow-up.

@pavelfeldman pavelfeldman merged commit a07a4a2 into microsoft:main Aug 25, 2022
rwoll added a commit to microsoft/playwright-python that referenced this pull request Sep 20, 2022
Ports:

  - [x] microsoft/playwright@a07a4a2 (chore: make parent scope explicit (microsoft/playwright#16819))
  - [x] microsoft/playwright@306ab34 (feat(assertions): support toBeEnabled({ enabled }) (microsoft/playwright#17058))
  - [x] microsoft/playwright@f0c5810 (feat(assertions): support toBeEditable({ editable }) (microsoft/playwright#17065))
  - [x] microsoft/playwright@bca13bc (feat(assertions): support toBeVisible({ visible }) (microsoft/playwright#17207))
  - [x] microsoft/playwright@17b203a (feat: added follow and redirect arguments to fetch (microsoft/playwright#17033))
- [x] microsoft/playwright@fea8772 (fix: emit load/domcontentloaded events as reported by the browser)
- [x] microsoft/playwright@01d83f1 (fix(har): record request overrides to har (microsoft/playwright#17027))
sbakerdev added a commit to sbakerdev/playwright-python that referenced this pull request Nov 29, 2022
Ports:

  - [x] microsoft/playwright@a07a4a2 (chore: make parent scope explicit (microsoft/playwright#16819))
  - [x] microsoft/playwright@306ab34 (feat(assertions): support toBeEnabled({ enabled }) (microsoft/playwright#17058))
  - [x] microsoft/playwright@f0c5810 (feat(assertions): support toBeEditable({ editable }) (microsoft/playwright#17065))
  - [x] microsoft/playwright@bca13bc (feat(assertions): support toBeVisible({ visible }) (microsoft/playwright#17207))
  - [x] microsoft/playwright@17b203a (feat: added follow and redirect arguments to fetch (microsoft/playwright#17033))
- [x] microsoft/playwright@fea8772 (fix: emit load/domcontentloaded events as reported by the browser)
- [x] microsoft/playwright@01d83f1 (fix(har): record request overrides to har (microsoft/playwright#17027))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants