Bug 1506852 - Make sure to also clear opener in BrowsingContext. r=peterv
authorAndreas Farre <farre@mozilla.com>
Tue, 20 Nov 2018 08:49:33 +0000
changeset 503635 1d9d15e8e072fb3f54ad858a4b6eabae2e7d8479
parent 503634 de0a29776deed09faa072a9058b5415c1e0dad46
child 503636 53ffafb6d58cfa360a0a5cfe0eaa4d3c02d2a174
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1506852
milestone65.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 1506852 - Make sure to also clear opener in BrowsingContext. r=peterv When calling nsGlobalWindowOuter::SetOpenerWindow with null we should make sure to also clear BrowsingContext::mOpener. Differential Revision: https://phabricator.services.mozilla.com/D11769
dom/base/nsGlobalWindowOuter.cpp
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -2261,21 +2261,21 @@ nsGlobalWindowOuter::SetOpenerWindow(nsP
                "aOriginalOpener is true, but not first call to "
                "SetOpenerWindow!");
   NS_ASSERTION(aOpener || !aOriginalOpener,
                "Shouldn't set mHadOriginalOpener if aOpener is null");
 
   mOpener = opener.forget();
   NS_ASSERTION(mOpener || !aOpener, "Opener must support weak references!");
 
-  if (mDocShell && aOpener) {
+  if (mDocShell) {
     // TODO(farre): Here we really wish to only consider the case
     // where 'aOriginalOpener' is false, and we also really want to
     // move opener entirely to BrowsingContext. See bug 1502330.
-    GetBrowsingContext()->SetOpener(aOpener->GetBrowsingContext());
+    GetBrowsingContext()->SetOpener(aOpener ? aOpener->GetBrowsingContext() : nullptr);
   }
 
   // Check that the js visible opener matches! We currently don't depend on this
   // being true outside of nightly, so we disable the assertion in optimized
   // release / beta builds.
   nsPIDOMWindowOuter* contentOpener = GetSanitizedOpener(aOpener);
 
   // contentOpener is not used when the DIAGNOSTIC_ASSERT is compiled out.