Bug 1450266 P4 Rebind DETH objects to the new global when document.open() is called. r=smaug

This commit is contained in:
Ben Kelly 2018-04-03 17:10:16 -07:00
parent 852bbba6c0
commit 25d3f442b6

View File

@ -1850,6 +1850,15 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
currentInner->mPerformance->GetDOMTiming(),
currentInner->mPerformance->GetChannel());
}
// Rebind DETH objects to the new global created by document.open().
// XXX: Is this correct? We should consider if the spec and our
// implementation should change to match other browsers by
// just reusing the current window. (Bug 1449992)
currentInner->ForEachEventTargetObject(
[&] (DOMEventTargetHelper* aDETH, bool* aDoneOut) {
aDETH->BindToOwner(newInnerWindow->AsGlobal());
});
}
// Don't free objects on our current inner window if it's going to be