Bug 1562292: Part 1c - Set BrowsingContext Closed flag at the same time as outer window's. r=nika
authorKris Maglione <maglione.k@gmail.com>
Thu, 01 Aug 2019 19:46:32 -0700
changeset 488063 a50f085eb3e6c506fd8e17acb669ef91b6f31390
parent 488062 a8ac7bcafc270b5be3eca84efebcde672fe8fba5
child 488064 ba987e21b5329d07c3606a65ee0cb76e7bc99a74
push id36435
push usercbrindusan@mozilla.com
push dateThu, 15 Aug 2019 09:46:49 +0000
treeherdermozilla-central@0db07ff50ab5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1562292
milestone70.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 1562292: Part 1c - Set BrowsingContext Closed flag at the same time as outer window's. r=nika We rely on the Closed flag to avoid targeting named window open operations to windows which have already closed. The DocShell's lookup logic checks the Closed flag of the outer window, while BrowsingContext's checks the flag of the context. The latter, however, is only set when the window's DocShell is destroyed, which happens much later, and leaves closed windows returning true from IsTargetable() for much longer than they should. This patch immediately sets the BrowsingContext's closed flag at the same time as we set the same flag on the outer window, and leaves the existing setters in case of any corner cases. Differential Revision: https://phabricator.services.mozilla.com/D40494
dom/base/nsGlobalWindowOuter.cpp
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -6327,16 +6327,18 @@ void nsGlobalWindowOuter::ForceClose() {
 
   FinalClose();
 }
 
 void nsGlobalWindowOuter::FinalClose() {
   // Flag that we were closed.
   mIsClosed = true;
 
+  GetBrowsingContext()->SetClosed(true);
+
   // If we get here from CloseOuter then it means that the parent process is
   // going to close our window for us. It's just important to set mIsClosed.
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     return;
   }
 
   // This stuff is non-sensical but incredibly fragile. The reasons for the
   // behavior here don't make sense today and may not have ever made sense,