Bug 1401379 - Part 5: Don't check for a docshell to determine if a window is alive, r=smaug
☠☠ backed out by 4dea37e579a7 ☠ ☠
authorNika Layzell <nika@thelayzells.com>
Mon, 02 Oct 2017 10:58:49 -0400
changeset 426570 0eb4a7009f434a09598c1aac58cf1e09ac830e62
parent 426569 ef2dfdd829bc01af51deb97103716e5db2097bcc
child 426571 8a26cdedeb58cd1b748dccd8f510cdcd69f0cc23
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewerssmaug
bugs1401379
milestone58.0a1
Bug 1401379 - Part 5: Don't check for a docshell to determine if a window is alive, r=smaug MozReview-Commit-ID: 8Ze3KrgpaTQ
dom/base/nsCCUncollectableMarker.cpp
dom/base/nsGlobalWindow.h
--- a/dom/base/nsCCUncollectableMarker.cpp
+++ b/dom/base/nsCCUncollectableMarker.cpp
@@ -503,17 +503,17 @@ mozilla::dom::TraceBlackJS(JSTracer* aTr
   }
 
   // Mark globals of active windows black.
   nsGlobalWindow::WindowByIdTable* windowsById =
     nsGlobalWindow::GetWindowsTable();
   if (windowsById) {
     for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
       nsGlobalWindow* window = iter.Data();
-      if (window->GetDocShell() && window->IsOuterWindow()) {
+      if (!window->IsCleanedUp() && window->IsOuterWindow()) {
         window->TraceGlobalJSObject(aTrc);
         EventListenerManager* elm = window->GetExistingListenerManager();
         if (elm) {
           elm->TraceListeners(aTrc);
         }
 
         if (window->IsRootOuterWindow()) {
           // In child process trace all the TabChildGlobals.
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -664,16 +664,22 @@ public:
   bool IsClosedOrClosing() {
     return (mIsClosed ||
             mInClose ||
             mHavePendingClose ||
             mCleanedUp);
   }
 
   bool
+  IsCleanedUp() const
+  {
+    return mCleanedUp;
+  }
+
+  bool
   HadOriginalOpener() const
   {
     MOZ_ASSERT(IsOuterWindow());
     return mHadOriginalOpener;
   }
 
   bool
   IsTopLevelWindow()