Closed Bug 1842936 Opened 2 years ago Closed 1 year ago

Inconsistency between WindowGlobalParent::IsCurrentGlobal() and nsPIDOMWindowInner::IsCurrentInnerWindow()

Categories

(Core :: DOM: Content Processes, defect)

defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox-esr115 121+ fixed
firefox119 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(2 files)

nsPIDOMWindowInner::IsCurrentInnerWindow() returns false if SHIP is enabled and the inner window has a BC that is in the BFCache. On the other hand, WindowGlobalParent::IsCurrentGlobal() doesn't consider that condition. This extra condition was added bug 1704068.

An example of where this can happen is in the test browser_contentWindow.js. This test loads one page, then uses BrowserTestUtils.loadURIString() to load a second page, then sends a message to the child actor in the first page. At that point in time, the inner window for the first page returns false for IsCurrentInnerWindow() because the BC is in the bfcache, but IsCurrentGlobal() called on the corresponding WindowGlobalParent returns true.

IsCurrentGlobal() doesn't have many callers, so I'm not sure how bad this is. Should it be changed to add the additional condition?

The fix is simple but I don't know if it makes sense or not to do.

(In reply to Andrew McCreight [:mccr8] from comment #2)

The fix is simple but I don't know if it makes sense or not to do.

:smaug, do you know?

Flags: needinfo?(smaug)

Looks like WindowGlobalParent::IsCurrentGlobal() is used very rarely, and callers should be fine with checking bfcache - except that I don't know about the extension code.

Flags: needinfo?(smaug)

zombie might know about https://searchfox.org/mozilla-central/search?q=isCurrentGlobal&path=extensions&case=false&regexp=false
At least one of those already explicitly checks for bfcache.

Flags: needinfo?(tomica)
Assignee: nobody → continuation
Status: NEW → ASSIGNED
Flags: needinfo?(tomica)
Pushed by amccreight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c8336f0ad9fb Make WindowGlobalParent::IsCurrentGlobal() consistent with nsPIDOMWindowInner::IsCurrentInnerWindow(). r=smaug
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
Blocks: 1863852

[Tracking Requested - why for this release]: needed for bug 1863852.

Attachment #9366098 - Flags: approval-mozilla-esr115?

Uplift Approval Request

  • Steps to reproduce for manual QE testing: none
  • Explanation of risk level: minor change to a corner case that has been on m-c since September without issue
  • Code covered by automated testing: yes
  • Is Android affected?: yes
  • String changes made/needed: none
  • Needs manual QE test: no
  • Risk associated with taking this patch: low
  • Fix verified in Nightly: yes
  • User impact if declined: needed for bug 1863852

Comment on attachment 9366098 [details]
Bug 1842936 - Make WindowGlobalParent::IsCurrentGlobal() consistent with nsPIDOMWindowInner::IsCurrentInnerWindow().

Approved for 115.6esr.

Attachment #9366098 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: