Closed Bug 1879320 Opened 9 months ago Closed 8 months ago

browsingContext.create should resolve only after browsingContext.contextCreated was emitted

Categories

(Remote Protocol :: WebDriver BiDi, defect, P3)

defect
Points:
2

Tracking

(firefox125 affected)

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- affected

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [webdriver:m10], [wptsync upstream])

Attachments

(2 files)

Currently in Firefox, a browsingContext.create command will resolve before browsingContext.contextCreated is emitted. This does not match the spec, because the steps to create a new window are synchronous and should trigger the contextCreated before returning.

Chrome implements the correct command + event order, and this discrepancy currently blocks a BiDi refactor in puppeteer: https://github.com/puppeteer/puppeteer/pull/11836

We should be able to internally wait for browsingContext.contextCreated before resolving the create command

While we don't explicitly wait for contextCreated in browsingContext.create, testing locally I always get the event before the command resolves.

Also looking at the implementation, we already have the browsing context and wait for the initial navigation to be done before we resolve, so it's a bit unlikely that we are emitting contextCreated after resolving.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Depends on D201104

This makes it very explicit that we are waiting for the context to be attached (and therefore contextCreated has been emitted), but I don't think we
need it.

We already have a valid browser.browsingContext and we also call waitForInitialNavigationCompleted, so I don't think there is any way the context is
not attached before we resolve.

It doesn't hurt to explicitly wait, but I think it's enough to have tests to check we are not regressing here.

Severity: -- → S3
Points: --- → 2
Priority: -- → P3
Whiteboard: [webdriver:m10]
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fdd447a68b68 [wdspec] Check browsingContext.contextCreated emitted before browsingContext.create resolves r=webdriver-reviewers,whimboo
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44969 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m10] → [webdriver:m10], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch

For now we just only landed a test to check how stable it is and if we need another fix for BiDi. So lets keep the bug open for a bit.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Upstream PR merged by moz-wptsync-bot

I wanted to check the stability of the new test on wpt.fyi but I'm not able to see the test results in the history.

Julian, could you please follow-up? So far it looks to pass in our CI as well, so maybe we don't need a fix for BiDi?

Flags: needinfo?(jdescottes)

The test is visible on your link and is always green on Firefox/Chrome/Edge.

Status: REOPENED → RESOLVED
Closed: 8 months ago8 months ago
Flags: needinfo?(jdescottes)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: