Bug 1539959 - Don't send WindowGlobalChild constructors when parent BrowsingContext has already been closed, r=farre
authorNika Layzell <nika@thelayzells.com>
Mon, 15 Apr 2019 14:57:09 +0000
changeset 469537 1837a4550e101c93c6dcce65ef09c5a7b6f72bb2
parent 469536 8a7d6786688ecbdac252bcc785ece83a5f72b2af
child 469538 127dba490969122ab2c7523bc98db6f739d95f0a
push id112801
push userccoroiu@mozilla.com
push dateMon, 15 Apr 2019 21:40:09 +0000
treeherdermozilla-inbound@afb20612c0e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfarre
bugs1539959
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1539959 - Don't send WindowGlobalChild constructors when parent BrowsingContext has already been closed, r=farre Differential Revision: https://phabricator.services.mozilla.com/D27365
dom/ipc/WindowGlobalChild.cpp
--- a/dom/ipc/WindowGlobalChild.cpp
+++ b/dom/ipc/WindowGlobalChild.cpp
@@ -55,16 +55,23 @@ already_AddRefed<WindowGlobalChild> Wind
       do_QueryInterface(aWindow->GetDocument()->GetChannel());
   nsILoadInfo::CrossOriginOpenerPolicy policy;
   if (chan && NS_SUCCEEDED(chan->GetCrossOriginOpenerPolicy(&policy))) {
     bc->SetOpenerPolicy(policy);
   }
 
   RefPtr<WindowGlobalChild> wgc = new WindowGlobalChild(aWindow, bc);
 
+  // If we have already closed our browsing context, return a pre-closed
+  // WindowGlobalChild actor.
+  if (bc->GetClosed()) {
+    wgc->ActorDestroy(FailedConstructor);
+    return wgc.forget();
+  }
+
   WindowGlobalInit init(principal, aWindow->GetDocumentURI(), bc,
                         wgc->mInnerWindowId, wgc->mOuterWindowId);
 
   // Send the link constructor over PInProcessChild or PBrowser.
   if (XRE_IsParentProcess()) {
     InProcessChild* ipc = InProcessChild::Singleton();
     if (!ipc) {
       return nullptr;