Bug 1516425 - Avoid unnecessarily attaching layers during shutdown of TabParent. r=aosmond, a=abillings
authorRyan Hunt <rhunt@eqrion.net>
Fri, 11 Jan 2019 13:24:57 -0600
changeset 516064 820b728e1ebe6dd1b211c9a8feb677104719b5ab
parent 516063 9bc496b10831867256841a46f2f6b2300054d7f1
child 516065 89ac71e3fa34388c0698a5af2e831a336a858052
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond, abillings
bugs1516425
milestone66.0
Bug 1516425 - Avoid unnecessarily attaching layers during shutdown of TabParent. r=aosmond, a=abillings
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1730,18 +1730,25 @@ void nsFrameLoader::SetOwnerContent(Elem
   JS::RootedObject wrapper(jsapi.cx(), GetWrapper());
   if (wrapper) {
     JSAutoRealm ar(jsapi.cx(), wrapper);
     IgnoredErrorResult rv;
     UpdateReflectorGlobal(jsapi.cx(), wrapper, rv);
     Unused << NS_WARN_IF(rv.Failed());
   }
 
-  if (RenderFrame* rfp = GetCurrentRenderFrame()) {
-    rfp->OwnerContentChanged(aContent);
+  // If we have reached here from StartDestroy, then there's no need to update
+  // the layers attached by the render frame, as it will be going away soon
+  if (mDestroyCalled) {
+    MOZ_ASSERT(!aContent);
+    return;
+  }
+
+  if (RenderFrame* rf = GetCurrentRenderFrame()) {
+    rf->OwnerContentChanged(aContent);
   }
 }
 
 bool nsFrameLoader::OwnerIsMozBrowserFrame() {
   nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
   return browserFrame ? browserFrame->GetReallyIsBrowser() : false;
 }