Closed Bug 1523841 Opened 6 years ago Closed 6 years ago

Fix outer window's SetNewDocument to handle the case when the old and new inner are same-compartment

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox67 --- affected

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

The current "Create a new outer and brain-transplant the old outer into a CCW" approach doesn't work in this case. What needs to happen instead is presumably that we create a new outer (so that we have the invariant that the outer's global is the current inner's global) and then brain-transplant the old outer into the new outer.

Isn't that what already happens right now? I think this situation also comes up with system windows and while debugging some issues there I noticed we do what you described in comment 0 (brain-transplant two outers, no CCWs).

Isn't that what already happens right now?

Yes, it is, based on reading the code. OK, good.

The remaining question is whether everyone can handle a Window whose WindowProxy is different-Realm from the Window (but same-compartment). I just audited all callsites of js::ToWindowProxyIfWindow and they all look OK. Going the other direction (js::ToWindowIfWindowProxy) doesn't change global. So I think we're good here...

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.