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

fix(domworld): reset bindings when context changes (#6766) #6836

Merged
merged 2 commits into from Feb 8, 2021

Conversation

jschfflr
Copy link
Contributor

@jschfflr jschfflr commented Feb 8, 2021

No description provided.

@google-cla google-cla bot added the cla: yes label Feb 8, 2021
@jschfflr jschfflr enabled auto-merge (squash) February 8, 2021 16:19
@jschfflr jschfflr merged commit 4e8d074 into main Feb 8, 2021
@jschfflr jschfflr deleted the domworld-bindings-reset branch February 8, 2021 18:56
Copy link
Member

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

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

Ugh I failed to submit this review comment. Jan is already tackling this nit as a follow-up patch

@@ -115,6 +115,7 @@ export class DOMWorld {

async _setContext(context?: ExecutionContext): Promise<void> {
if (context) {
this._ctxBindings = new Set();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this._ctxBindings = new Set();
this._ctxBindings.clear();

it('should persist query handler bindings across navigations', async () => {
const { page, server } = getTestState();

// Reset page but make sure that execution context ids start with 1.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment confuses me. How do you assert the ids?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how how the execution context ids are generated. But it seems like navigating within one origin results in incrementing ids while navigating across origins resets the ids to 1 again. That's why I added the two navigations there.
The previous test just checked by reloading the page which did not reset the ids and therefor did not uncover this edge case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants