Bug 1320765 - Test mRemoteBrowser to avoid crash during swapping frame loaders. r=mystor
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 29 Nov 2016 13:49:17 -0600
changeset 324792 12db8198fa96e1620648583ca1d06a7ef97fb18d
parent 324791 093f781b5d6f11ce039bc0655b566646e4d4e92a
child 324793 7eab0a7c766e258f2849edf6b8666727354a2968
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmystor
bugs1320765
milestone53.0a1
Bug 1320765 - Test mRemoteBrowser to avoid crash during swapping frame loaders. r=mystor MozReview-Commit-ID: 9Ypk1FmdjUU
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1267,16 +1267,20 @@ nsFrameLoader::SwapWithOtherRemoteLoader
   }
 
   nsIPresShell* ourShell = ourDoc->GetShell();
   nsIPresShell* otherShell = otherDoc->GetShell();
   if (!ourShell || !otherShell) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
+  if (!mRemoteBrowser || !aOther->mRemoteBrowser) {
+    return NS_ERROR_NOT_IMPLEMENTED;
+  }
+
   if (mRemoteBrowser->IsIsolatedMozBrowserElement() !=
       aOther->mRemoteBrowser->IsIsolatedMozBrowserElement()) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // When we swap docShells, maybe we have to deal with a new page created just
   // for this operation. In this case, the browser code should already have set
   // the correct userContextId attribute value in the owning XULElement, but our