-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Conversation
packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
Show resolved
Hide resolved
packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts
Outdated
Show resolved
Hide resolved
packages/playwright-core/src/server/dispatchers/networkDispatchers.ts
Outdated
Show resolved
Hide resolved
packages/playwright-core/src/server/dispatchers/pageDispatcher.ts
Outdated
Show resolved
Hide resolved
7a72e6d
to
c0cbb6b
Compare
@@ -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) }; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: [] }, | ||
] }, |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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))
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))
No description provided.