Bug ? - Remove redundant Docshell destroyed check; r?nika draft
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 27 Jun 2018 16:49:28 -0700
changeset 813690 ea929610b7fc61e6d8e1d7c364974c9f37f83710
parent 813581 a0e47ebc4c06e652b919dabee711fdbd6bfd31b5
child 813691 2fd21fe7bc33591cc4c2779978fb1579382e9c76
push id114972
push userbmo:kyle@nonpolynomial.com
push dateTue, 03 Jul 2018 18:23:45 +0000
reviewersnika
bugs369126, 94229
milestone63.0a1
Bug ? - Remove redundant Docshell destroyed check; r?nika Checks added in Bug 369126 and Bug 94229. There's not a point between these two checks where a DocShell can be destroyed, and they return 2 different errors. Keeping version of Bug 369126. MozReview-Commit-ID: HXUv5VbXEGA
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9189,16 +9189,18 @@ nsDocShell::InternalLoad(nsIURI* aURI,
   }
 
   if (!aURI) {
     return NS_ERROR_NULL_POINTER;
   }
 
   NS_ENSURE_TRUE(IsValidLoadType(aLoadType), NS_ERROR_INVALID_ARG);
 
+  // If this docshell is being destroyed, we'll run into assertions even if we
+  // have a different window target and are not loading into. Bail early.
   NS_ENSURE_TRUE(!mIsBeingDestroyed, NS_ERROR_NOT_AVAILABLE);
 
   rv = EnsureScriptEnvironment();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // wyciwyg urls can only be loaded through history. Any normal load of
@@ -9566,24 +9568,16 @@ nsDocShell::InternalLoad(nsIURI* aURI,
     }
 
     // Else we ran out of memory, or were a popup and got blocked,
     // or something.
 
     return rv;
   }
 
-  //
-  // Load is being targetted at this docshell so return an error if the
-  // docshell is in the process of being destroyed.
-  //
-  if (mIsBeingDestroyed) {
-    return NS_ERROR_FAILURE;
-  }
-
   NS_ENSURE_STATE(!HasUnloadedParent());
 
   rv = CheckLoadingPermissions();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (mFiredUnloadEvent) {