Closed Bug 1847563 Opened 2 years ago Closed 2 years ago

`browsingContext.domContentLoaded` can have context set to null

Categories

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

Firefox 118
defect
Points:
3

Tracking

(firefox119 fixed)

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: lightning00blade, Assigned: jdescottes)

References

Details

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

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 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.

Status: UNCONFIRMED → NEW
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
Status: NEW → ASSIGNED

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 jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bccc4a0a8662 [remote] Allow MessageHandler modules to cancel intercepted events r=webdriver-reviewers,Sasha https://hg.mozilla.org/integration/autoland/rev/75072208d649 [remote] Add isValidCanonicalBrowsingContext to check against discarded contexts r=webdriver-reviewers,whimboo https://hg.mozilla.org/integration/autoland/rev/6706e17fe8c3 [bidi] Cancel intercepted bidi events for invalid contexts r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
Whiteboard: [webdriver:backlog] → [webdriver:m8][webdriver:relnote]
Points: --- → 3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: