Skip to content

chore(bidi): emit load events after browsingContext.create#40944

Merged
dgozman merged 1 commit into
microsoft:mainfrom
hbenl:load-events-on-create
May 22, 2026
Merged

chore(bidi): emit load events after browsingContext.create#40944
dgozman merged 1 commit into
microsoft:mainfrom
hbenl:load-events-on-create

Conversation

@hbenl
Copy link
Copy Markdown
Collaborator

@hbenl hbenl commented May 21, 2026

According to the Bidi spec, no browsingContext.domContentLoaded and browsingContext.load events should be fired for new browsing contexts until they navigate away from about:blank (both Chrome's and Firefox's implementations are now aligned with this). But the Playwright API expects these events even for about:blank.
With this PR Playwright emits the domcontentloaded and load events after browsingContext.create returns.
Note that this doesn't fix the issue for iframes and popups because when Playwright receives the browsingContext.contextCreated event it is impossible to tell if the iframe/popup will navigate away from about:blank (in which case browsingContext.domContentLoaded and browsingContext.load will be fired after the navigation) or not (in which case no other events will be fired), see this spec issue.

Fixes the following tests:

  • library/browsercontext-base-url.spec.ts › should construct a new URL when a baseURL in browserType.launchPersistentContext is passed to page.goto
  • library/browsercontext-cookies-third-party.spec.ts › should(not) block third party cookies - persistent context
  • library/client-certificates.spec.ts › browser › persistentContext › should pass with matching certificates
  • library/defaultbrowsercontext-1.spec.ts › context.addCookies() should work
  • library/defaultbrowsercontext-1.spec.ts › context.clearCookies() should work
  • library/defaultbrowsercontext-1.spec.ts › context.cookies() should work
  • library/defaultbrowsercontext-1.spec.ts › should support acceptDownloads option
  • library/defaultbrowsercontext-1.spec.ts › should support deviceScaleFactor option
  • library/defaultbrowsercontext-1.spec.ts › should support httpCredentials option
  • library/defaultbrowsercontext-1.spec.ts › should support offline option
  • library/defaultbrowsercontext-1.spec.ts › should support userAgent option
  • library/defaultbrowsercontext-1.spec.ts › should support viewport option
  • library/defaultbrowsercontext-2.spec.ts › dialog.accept should work
  • library/defaultbrowsercontext-2.spec.ts › exposes browser
  • library/defaultbrowsercontext-2.spec.ts › should accept relative userDataDir
  • library/defaultbrowsercontext-2.spec.ts › should accept userDataDir
  • library/defaultbrowsercontext-2.spec.ts › should connect to a browser with the default page
  • library/defaultbrowsercontext-2.spec.ts › should create userDataDir if it does not exist
  • library/defaultbrowsercontext-2.spec.ts › should fire close event for a persistent context
  • library/defaultbrowsercontext-2.spec.ts › should have default URL when launching browser
  • library/defaultbrowsercontext-2.spec.ts › should respect selectors
  • library/defaultbrowsercontext-2.spec.ts › should restore state from userDataDir
  • library/defaultbrowsercontext-2.spec.ts › should support extraHTTPHeaders option
  • library/defaultbrowsercontext-2.spec.ts › should support geolocation and permissions options
  • library/defaultbrowsercontext-2.spec.ts › should support har option
  • library/defaultbrowsercontext-2.spec.ts › should support ignoreHTTPSErrors option
  • library/defaultbrowsercontext-2.spec.ts › should support locale option
  • library/defaultbrowsercontext-2.spec.ts › should support timezoneId option
  • library/defaultbrowsercontext-2.spec.ts › user agent is up to date
  • library/downloads-path.spec.ts › downloads path › should accept downloads in persistent context
  • library/downloads-path.spec.ts › downloads path › should delete downloads when persistent context closes
  • library/firefox/launcher.spec.ts › should pass firefox user preferences in persistent
  • library/har.spec.ts › should have pages in persistent context
  • library/multiclient.spec.ts › should launch persistent
  • page/page-wait-for-load-state.spec.ts › should wait for load state of newPage

@hbenl hbenl force-pushed the load-events-on-create branch from 21e3403 to b611c55 Compare May 21, 2026 15:37
@dgozman dgozman merged commit 7eb4045 into microsoft:main May 22, 2026
3 of 4 checks passed
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