Closed Bug 1746332 Opened 3 years ago Closed 3 years ago

Expose replace bit in "browsing-context-attached" notification

Categories

(Core :: DOM: Navigation, enhancement, P2)

enhancement
Points:
2

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Whiteboard: [bidi-m3-mvp])

Attachments

(1 file)

Similar to browsing-context-discarded it would be helpful to have a replace bit for the browsing-context-attached notification. That would help to indicate if the new browsing context is based on a newly opened tab or attached iframe, or just triggered by a browsing context group switch.

Related code for browsing-context-discarded can be found here:
https://searchfox.org/mozilla-central/rev/667224045f6e624ac4e730171c75c21945f1b336/docshell/base/BrowsingContext.cpp#907-916

Nika, which kind of check would be necessary here in the C++ code so that we could set this flag? Thanks!

Flags: needinfo?(nika)

It's not super elegant, but we can probably get away with using whether or not we need to create a new mWebProgress when attaching (https://searchfox.org/mozilla-central/rev/125116c312b0a9c438d44e16011b116950caf17e/docshell/base/BrowsingContext.cpp#800-804) to determine if it's a fresh BrowsingContext, or replacing an existing one.

The logic would need to be that by-default it's a non-replacing load, but if XRE_IsParentProcess() && IsTop() && IsContent() && Canonical()->mWebProgress before the member is ensured to be initialized, then the BC is being created as a replacement for an existing BC.

Flags: needinfo?(nika)

(In reply to Nika Layzell [:nika] (ni? for response) from comment #2)

It's not super elegant, but we can probably get away with using whether or not we need to create a new mWebProgress when attaching (https://searchfox.org/mozilla-central/rev/125116c312b0a9c438d44e16011b116950caf17e/docshell/base/BrowsingContext.cpp#800-804) to determine if it's a fresh BrowsingContext, or replacing an existing one.

The logic would need to be that by-default it's a non-replacing load, but if XRE_IsParentProcess() && IsTop() && IsContent() && Canonical()->mWebProgress before the member is ensured to be initialized, then the BC is being created as a replacement for an existing BC.

Nika, are you suggesting that we close this bug as WONTFIX because callers can use this workaround to determine whether a BrowsingContext is new or replaced? Or were you sketching how BrowsingContext might implement this new API?

Flags: needinfo?(nika)

Chris, we need this information from JS code and as chatted with Nika end of last week this is a proposal in how to get the information included within the browsing-context-attached notification.

Flags: needinfo?(nika)
Severity: -- → N/A
Priority: -- → P3

I'm going to take that bug given that we need it for WebDriver BiDi milestone 3.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Whiteboard: [bidi-m3-mvp]
Priority: P3 → P2
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e11d150fc701 Expose replace bit for "browsing-context-attached" notification. r=nika
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Points: --- → 2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: