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(chromium): fix a race between Page.enable and Page.getFrameTree #1201

Merged
merged 1 commit into from
Mar 4, 2020
Merged

fix(chromium): fix a race between Page.enable and Page.getFrameTree #1201

merged 1 commit into from
Mar 4, 2020

Conversation

dgozman
Copy link
Contributor

@dgozman dgozman commented Mar 4, 2020

We send Page.enable before Page.getFrameTree. That means we could receive Page.frameNavigated event after Page.enable response but before Page.getFrameTree response, at the point where main frame is not initialized yet.

To fix this, we can ignore any events from the Page domain which arrive before Page.getFrameTree response. Since no other domain is enabled yet, we can move all event handlers together.

Here is a failure stack trace:

  TypeError: Cannot read property 'childFrames' of undefined
      at FrameManager.frameCommittedNewDocumentNavigation (/home/runner/work/playwright/playwright/src/frames.ts:112:11)
      at CRPage._onFrameNavigated (/home/runner/work/playwright/playwright/src/chromium/crPage.ts:173:3)
      at CRSession.CRPage._eventListeners.helper_1.helper.addEventListener.event (/home/runner/work/playwright/playwright/src/chromium/crPage.ts:75:75)
      at CRSession.emit (events.js:189:13)
      at Promise.resolve.then (/home/runner/work/playwright/playwright/src/chromium/crConnection.ts:165:5)
      at process._tickCallback (internal/process/next_tick.js:68:7)

…urceTree

We used to send Page.enable before Page.getResourceTree. That meant we
could receive Page.frameNavigated event after Page.enable response
but before Page.getResourceTree response, and therefore main frame
was not initialized yet.
@yury-s yury-s merged commit 1c4619e into microsoft:master Mar 4, 2020
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.

2 participants