Merge mozilla-beta to release. a=merge FIREFOX_51_0_BUILD2 FIREFOX_51_0_RELEASE
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 18 Jan 2017 15:36:53 -0500
changeset 359419 ea82b5e20cbbd103f8fa65f0df0386ee4135cc47
parent 359417 aa8b10dca83df22981e98ce094adc7bcfb54101a (current diff)
parent 359418 8e692dd4176cba81ce020b29ae8b352dc1db724a (diff)
child 359420 4ac4d1d6d1d9224518e2095b3d4adbd16f1a8cdc
child 359422 e293c578e69b52052d892b6338b6a61f61a4ac7f
push id1334
push userryanvm@gmail.com
push dateWed, 18 Jan 2017 20:36:59 +0000
treeherdermozilla-release@ea82b5e20cbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone51.0
Merge mozilla-beta to release. a=merge
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -4519,18 +4519,26 @@ nsDocument::SetScriptGlobalObject(nsIScr
     // clients.  We only do this for content principal documents
     // since we can never observe system or null principals.
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os) {
       os->AddObserver(this, "service-worker-get-client", /* ownsWeak */ false);
     }
   }
 
+  // BlockOnload() might be called before mScriptGlobalObject is set.
+  // We may need to add the blocker once mScriptGlobalObject is set.
+  bool needOnloadBlocker = !mScriptGlobalObject && aScriptGlobalObject;
+
   mScriptGlobalObject = aScriptGlobalObject;
 
+  if (needOnloadBlocker) {
+    EnsureOnloadBlocker();
+  }
+
   if (aScriptGlobalObject) {
     mHasHadScriptHandlingObject = true;
     mHasHadDefaultView = true;
     // Go back to using the docshell for the layout history state
     mLayoutHistoryState = nullptr;
     mScopeObject = do_GetWeakReference(aScriptGlobalObject);
 #ifdef DEBUG
     if (!mWillReparent) {