Backed out changeset d05c6310d573 (bug 1509906) for increasing the severity of bug 1518863. r=Gijs, a=RyanVM
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 14 Jan 2019 12:08:11 -0500
changeset 509463 8f38ca46fb4495a087734b8269a61a51c284e6da
parent 509462 fcd8db2c5ac685be39cee633b09f44231849ea04
child 509464 4befe1a74031dbeb0f106449047f3f827fe45d7d
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, RyanVM
bugs1509906, 1518863
milestone65.0
backs outd05c6310d573658af4a4f2cee332bb01732fcabf
Backed out changeset d05c6310d573 (bug 1509906) for increasing the severity of bug 1518863. r=Gijs, a=RyanVM
browser/base/content/browser.js
browser/base/content/tabbrowser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1634,17 +1634,17 @@ var gBrowserInit = {
         });
       } else {
         // If the initial browser is not remote, we can focus the browser
         // immediately with no paint performance impact.
         gBrowser.selectedBrowser.focus();
       }
     });
     // Delay removing the attribute using requestAnimationFrame to avoid
-    // invalidating styles multiple times in a row if uriToLoadPromise
+    // invalidating styles multiple times in a row if _uriToLoadPromise
     // resolves before first paint.
     if (shouldRemoveFocusedAttribute) {
       window.requestAnimationFrame(() => {
         if (shouldRemoveFocusedAttribute)
           gURLBar.removeAttribute("focused");
       });
     }
   },
@@ -1813,19 +1813,19 @@ var gBrowserInit = {
     scheduleIdleTask(() => {
       this.idleTasksFinished = true;
       Services.obs.notifyObservers(window, "browser-idle-startup-tasks-finished");
     });
   },
 
   // Returns the URI(s) to load at startup if it is immediately known, or a
   // promise resolving to the URI to load.
-  get uriToLoadPromise() {
-    delete this.uriToLoadPromise;
-    return this.uriToLoadPromise = function() {
+  get _uriToLoadPromise() {
+    delete this._uriToLoadPromise;
+    return this._uriToLoadPromise = function() {
       // window.arguments[0]: URI to load (string), or an nsIArray of
       //                      nsISupportsStrings to load, or a xul:tab of
       //                      a tabbrowser, which will be replaced by this
       //                      window (for this case, all other arguments are
       //                      ignored).
       if (!window.arguments || !window.arguments[0]) {
         return null;
       }
@@ -1847,24 +1847,23 @@ var gBrowserInit = {
         return willOverride ? null : uri;
       }
       return willOverride.then(willOverrideHomepage =>
                                  willOverrideHomepage ? null : uri);
     }();
   },
 
   // Calls the given callback with the URI to load at startup.
-  // Synchronously if possible, or after uriToLoadPromise resolves otherwise.
+  // Synchronously if possible, or after _uriToLoadPromise resolves otherwise.
   _callWithURIToLoad(callback) {
-    let uriToLoad = this.uriToLoadPromise;
-    if (uriToLoad && uriToLoad.then) {
+    let uriToLoad = this._uriToLoadPromise;
+    if (!uriToLoad || !uriToLoad.then)
+      callback(uriToLoad);
+    else
       uriToLoad.then(callback);
-    } else {
-      callback(uriToLoad);
-    }
   },
 
   onUnload() {
     gUIDensity.uninit();
 
     TabsInTitlebar.uninit();
 
     ToolbarIconColor.uninit();
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -276,51 +276,44 @@ window._gBrowser = {
     return this._selectedBrowser;
   },
 
   _setupInitialBrowserAndTab() {
     // See browser.js for the meaning of window.arguments.
     // Bug 1485961 covers making this more sane.
     let userContextId = window.arguments && window.arguments[6];
 
-    let tabArgument = gBrowserInit.getTabToAdopt();
+    // We default to a remote content browser, except if:
+    // - e10s is disabled.
+    // - there's a parent process opener (e.g. parent process about: page) for
+    //   the content tab.
+    let remoteType;
+    if (gMultiProcessBrowser && !window.hasOpenerForInitialContentBrowser) {
+      remoteType = E10SUtils.DEFAULT_REMOTE_TYPE;
+    } else {
+      remoteType = E10SUtils.NOT_REMOTE;
+    }
 
     // We only need sameProcessAsFrameLoader in the case where we're passed a tab
     let sameProcessAsFrameLoader;
-    // If we have a tab argument with browser, we use its remoteType. Otherwise,
-    // if e10s is disabled or there's a parent process opener (e.g. parent
-    // process about: page) for the content tab, we use a parent
-    // process remoteType. Otherwise, we check the URI to determine
-    // what to do - if there isn't one, we default to the default remote type.
-    let remoteType;
-    if (tabArgument && tabArgument.linkedBrowser) {
-      remoteType = tabArgument.linkedBrowser.remoteType;
-      sameProcessAsFrameLoader = tabArgument.linkedBrowser.frameLoader;
-    } else if (!gMultiProcessBrowser || window.hasOpenerForInitialContentBrowser) {
-      remoteType = E10SUtils.NOT_REMOTE;
-    } else {
-      let uriToLoad = gBrowserInit.uriToLoadPromise;
-      if (uriToLoad && typeof uriToLoad == "string") {
-        remoteType = E10SUtils.getRemoteTypeForURI(
-          uriToLoad,
-          gMultiProcessBrowser,
-          E10SUtils.DEFAULT_REMOTE_TYPE
-        );
-      } else {
-        remoteType = E10SUtils.DEFAULT_REMOTE_TYPE;
-      }
-    }
-
-    if (tabArgument && tabArgument.hasAttribute("usercontextid")) {
+    let tabArgument = gBrowserInit.getTabToAdopt();
+    if (tabArgument) {
       // The window's first argument is a tab if and only if we are swapping tabs.
       // We must set the browser's usercontextid so that the newly created remote
       // tab child has the correct usercontextid.
-      userContextId = parseInt(tabArgument.getAttribute("usercontextid"), 10);
-    }
-
+      if (tabArgument.hasAttribute("usercontextid")) {
+        userContextId = parseInt(tabArgument.getAttribute("usercontextid"), 10);
+      }
+
+      let linkedBrowser = tabArgument.linkedBrowser;
+      if (linkedBrowser) {
+        remoteType = linkedBrowser.remoteType;
+        sameProcessAsFrameLoader = linkedBrowser.frameLoader;
+      }
+    }
     let createOptions = {
       uriIsAboutBlank: false,
       userContextId,
       sameProcessAsFrameLoader,
       remoteType,
     };
     let browser = this._createBrowser(createOptions);
     browser.setAttribute("primary", "true");