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(bidi): set initial frame url from creation event #34198

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member Author

Choose a reason for hiding this comment

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

We can probably call

page._page._frameManager.frameCommittedNewDocumentNavigation(event.context, event.url, '', '', true);
page._page._frameManager.frameLifecycleEvent(event.context, 'domcontentloaded');
page._page._frameManager.frameLifecycleEvent(event.context, 'load');

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
Loading