Bug 1294237 - Set userContextId when DOMContentLoaded before updateBrowserRemoteness. r=mconley
authorJonathan Hao <jhao@mozilla.com>
Fri, 12 Aug 2016 02:10:00 -0400
changeset 309598 c7e5f970ee618bf454a14aae498a8031b1dfa100
parent 309597 831107a4950a1fcc7c0f86240fd9f62a165bbe88
child 309702 5aa02060f7c47a1d4c2c198c18ab7fc59771467b
push id80664
push userryanvm@gmail.com
push dateWed, 17 Aug 2016 03:21:36 +0000
treeherdermozilla-inbound@c7e5f970ee61 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1294237
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1294237 - Set userContextId when DOMContentLoaded before updateBrowserRemoteness. r=mconley
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -880,16 +880,27 @@ addEventListener("DOMContentLoaded", fun
         .QueryInterface(Ci.nsIInterfaceRequestor)
         .getInterface(Ci.nsIXULWindow)
         .XULBrowserWindow = window.XULBrowserWindow;
   window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
     new nsBrowserAccess();
 
   let initBrowser =
     document.getAnonymousElementByAttribute(gBrowser, "anonid", "initialBrowser");
+
+  // The window's first argument is a tab if and only if we are swapping tabs.
+  // We must set the browser's usercontextid before updateBrowserRemoteness(),
+  // so that the newly created remote tab child has the correct usercontextid.
+  if (window.arguments) {
+    let tabToOpen = window.arguments[0];
+    if (tabToOpen instanceof XULElement && tabToOpen.hasAttribute("usercontextid")) {
+      initBrowser.setAttribute("usercontextid", tabToOpen.getAttribute("usercontextid"));
+    }
+  }
+
   gBrowser.updateBrowserRemoteness(initBrowser, gMultiProcessBrowser);
 });
 
 var gBrowserInit = {
   delayedStartupFinished: false,
 
   onLoad: function() {
     gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver, false);