Closed Bug 1847563 Opened 7 months ago Closed 6 months ago

`browsingContext.domContentLoaded` can have context set to null


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

Firefox 118


(firefox119 fixed)

119 Branch
Tracking Status
firefox119 --- fixed


(Reporter: lightning00blade, Assigned: jdescottes)



(Whiteboard: [webdriver:m8][webdriver:relnote])


(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Steps to reproduce:

Run the following Puppeteer test in evaluation.spec.ts
should work with unicode chars
should throw when evaluation triggers reload
should await promise

Attached Puppeteer debugging logs + Firefox Traces.

Actual results:

Individually all pass as expected, but when run one after the other an event browsingContext.domContentLoaded with context:null sneaks in.
This is not per spec so our implementation fails
Most likely do the code in should throw when evaluation triggers reload as it triggers a navigation and we close the page soon after.

Expected results:

The event should not be fired if its not related to any browsingContext.

Also happens for this pair of Puppeteer tests in page.spec.ts:
should respect timeout
should respect default navigation timeout

Thanks! I can easily reproduce by running commands inspired from the should throw when evaluation triggers reload test:

  • browsingContext.create
  • browsingContext.navigate to "about:blank"
  • script.callFunction with location.reload
  • browsingContext.close

And I agree that if we receive events for a browsing context which no longer exists, we should just discard them.

Ever confirmed: true
Depends on: 1846343

The severity field is not set for this bug.
:whimboo, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hskupin)
Severity: -- → S3
Flags: needinfo?(hskupin)
Priority: -- → P2
Whiteboard: [webdriver:backlog]
Depends on: 1852508
Blocks: 1851438
No longer depends on: 1852508
Assignee: nobody → jdescottes

Depends on D188101

If the browsing context is discarded, it will not have any embedderElement attached, and we cannot process it as expected.
Add the helper and use it for the existing spots checking for valid browsing contexts.

Attachment #9352937 - Attachment description: Bug 1847563 - [bidi] Do not emit browsingContext events for invalid contexts → Bug 1847563 - [bidi] Cancel intercepted bidi events for invalid contexts
Pushed by
[remote] Allow MessageHandler modules to cancel intercepted events r=webdriver-reviewers,Sasha
[remote] Add isValidCanonicalBrowsingContext to check against discarded contexts r=webdriver-reviewers,whimboo
[bidi] Cancel intercepted bidi events for invalid contexts r=webdriver-reviewers,whimboo
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
Whiteboard: [webdriver:backlog] → [webdriver:m8][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.