Closed Bug 1869735 Opened 2 months ago Closed 2 months ago

Wrong context id for network events of iframe navigation requests


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



(firefox122 fixed)

122 Branch
Tracking Status
firefox122 --- fixed


(Reporter: jdescottes, Assigned: jdescottes)


(Blocks 4 open bugs)


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


(2 files)


ER: The network events for the iframe navigation should be associated with the context id of the iframe
AR: The network events are using the parent window context id

Subsequent requests (eg favicon) done in the iframe will have the correct context id, the one from the iframe.

This means we get the wrong navigation id in those requests.

We also have the same issue when dynamically adding an iframe in a page, the initial request to create the iframe will be mapped to the parent's context id, which makes one puppeteer test fail (network Request.frame should work for subframe navigation request).

Hi Valentin,

See description above for more details, tldr channels created for an iframe navigation always seem "owned" by the iframe's parent context.

At the moment we are retrieving the BrowsingContext corresponding to a channel via channel.loadInfo.browsingContextID, and we are doing this when receiving the activity ACTIVITY_SUBTYPE_REQUEST_HEADER. I've also tried to look at the loadContext's associatedWindow or topFrameElement, but they are always set to the frame's parent.

Do you know if there is a way to link those channels to the BrowsingContext of the iframe being loaded/navigated?

Flags: needinfo?(moz.valentin)

Ah I see there is frameBrowsingContextID on the loadInfo, which seems to do exactly what I asked. Leaving the ni? in case you have some more insights, but looks like we have enough to fix it on our own.

I don't have any more info. I'm glad frameBrowsingContext gets you the information you need.

Flags: needinfo?(moz.valentin)
Assignee: nobody → jdescottes
Pushed by
[devtools] Use frameBrowsingContextID if available in network getChannelBrowsingContextID r=webdriver-reviewers,devtools-reviewers,bomsy,whimboo
[wdspec] Add a network event test asserting iframe navigations r=webdriver-reviewers,whimboo
Created web-platform-tests PR for changes under testing/web-platform/tests
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Upstream PR merged by moz-wptsync-bot
Severity: -- → S3
Points: --- → 2
Priority: -- → P2
Whiteboard: [webdriver:m9]
Whiteboard: [webdriver:m9] → [webdriver:m9][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.