Skip to content

Commit

Permalink
fix(bidi): set initial frame url from creation event (#34198)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Jan 3, 2025
1 parent 6bdd269 commit dca95ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/playwright-core/src/server/bidi/bidiBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ export class BidiBrowser extends Browser {
continue;
page._session.addFrameBrowsingContext(event.context);
page._page._frameManager.frameAttached(event.context, parentFrameId);
const frame = page._page._frameManager.frame(event.context);
if (frame)
frame._url = event.url;
return;
}
return;
Expand All @@ -164,6 +167,7 @@ export class BidiBrowser extends Browser {
const session = this._connection.createMainFrameBrowsingContextSession(event.context);
const opener = event.originalOpener && this._bidiPages.get(event.originalOpener);
const page = new BidiPage(context, session, opener || null);
page._page.mainFrame()._url = event.url;
this._bidiPages.set(event.context, page);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bidi/expectations/bidi-chromium-library.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ library/browsercontext-network-event.spec.ts › BrowserContext.Events.RequestFi
library/browsercontext-network-event.spec.ts › BrowserContext.Events.Response [pass]
library/browsercontext-network-event.spec.ts › should fire events in proper order [pass]
library/browsercontext-network-event.spec.ts › should not fire events for favicon or favicon redirects [unknown]
library/browsercontext-page-event.spec.ts › should fire page lifecycle events [fail]
library/browsercontext-page-event.spec.ts › should fire page lifecycle events [pass]
library/browsercontext-page-event.spec.ts › should have about:blank for empty url with domcontentloaded [fail]
library/browsercontext-page-event.spec.ts › should have about:blank url with domcontentloaded [fail]
library/browsercontext-page-event.spec.ts › should have an opener [pass]
Expand Down
2 changes: 1 addition & 1 deletion tests/bidi/expectations/bidi-firefox-nightly-library.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ library/browsercontext-network-event.spec.ts › BrowserContext.Events.Response
library/browsercontext-network-event.spec.ts › should fire events in proper order [pass]
library/browsercontext-network-event.spec.ts › should not fire events for favicon or favicon redirects [unknown]
library/browsercontext-network-event.spec.ts › should reject response.finished if context closes [timeout]
library/browsercontext-page-event.spec.ts › should fire page lifecycle events [fail]
library/browsercontext-page-event.spec.ts › should fire page lifecycle events [pass]
library/browsercontext-page-event.spec.ts › should have about:blank for empty url with domcontentloaded [timeout]
library/browsercontext-page-event.spec.ts › should have about:blank url with domcontentloaded [pass]
library/browsercontext-page-event.spec.ts › should have an opener [pass]
Expand Down

0 comments on commit dca95ba

Please sign in to comment.