Bug 1147911 Part 3: Add remote type parameter to forceInitialBrowserRemote. r=gijs
☠☠ backed out by feadf85d42ec ☠ ☠
authorBob Owen <bobowencode@gmail.com>
Wed, 23 Nov 2016 13:36:57 +0000
changeset 324082 ec84ee6acb880a630dbdd274b074713984a75ed7
parent 324081 5b26ae9afaea99909f22dc274f259575c0a998dc
child 324083 7dc106b5496086c1b25bc8e321432b26ae8114ea
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersgijs
bugs1147911
milestone53.0a1
Bug 1147911 Part 3: Add remote type parameter to forceInitialBrowserRemote. r=gijs Also change talos pageloader.js to force type to match test URLs.
browser/base/content/browser.js
testing/talos/talos/pageloader/chrome/pageloader.js
xpfe/appshell/nsIXULBrowserWindow.idl
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4204,20 +4204,20 @@ var XULBrowserWindow = {
     var securityUI = gBrowser.securityUI;
     this.onSecurityChange(null, null, securityUI.state, true);
   },
 
   setJSStatus: function() {
     // unsupported
   },
 
-  forceInitialBrowserRemote: function() {
+  forceInitialBrowserRemote: function(aRemoteType) {
     let initBrowser =
       document.getAnonymousElementByAttribute(gBrowser, "anonid", "initialBrowser");
-    return initBrowser.frameLoader.tabParent;
+    gBrowser.updateBrowserRemoteness(initBrowser, true, aRemoteType, null);
   },
 
   forceInitialBrowserNonRemote: function(aOpener) {
     let initBrowser =
       document.getAnonymousElementByAttribute(gBrowser, "anonid", "initialBrowser");
     gBrowser.updateBrowserRemoteness(initBrowser, false, E10SUtils.NOT_REMOTE, aOpener);
   },
 
--- a/testing/talos/talos/pageloader/chrome/pageloader.js
+++ b/testing/talos/talos/pageloader/chrome/pageloader.js
@@ -216,41 +216,37 @@ function plInit() {
 
       gPaintWindow = browserWindow;
       // get our window out of the way
       window.resizeTo(10,10);
 
       var browserLoadFunc = function (ev) {
         browserWindow.removeEventListener('load', browserLoadFunc, true);
 
-        function firstPageCanLoadAsRemote() {
-          return E10SUtils.canLoadURIInProcess(pageUrls[0], Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT);
-        }
-
         // do this half a second after load, because we need to be
         // able to resize the window and not have it get clobbered
         // by the persisted values
         setTimeout(function () {
                      // For e10s windows, since bug 1261842, the initial browser is remote unless
                      // it attempts to browse to a URI that should be non-remote (landed at bug 1047603).
                      //
-                     // However, when it loads such URI and reinitializes as non-remote, we lose the
-                     // load listener and the injected tpRecordTime.
-                     //
-                     // The preferred pageloader behaviour in e10s is to run the pages as as remote,
-                     // so if the page can load as remote, we will load it as remote.
+                     // However, when it loads a URI that requires a different remote type,
+                     // we lose the load listener and the injected tpRecordTime.remote,
                      //
                      // It also probably means that per test (or, in fact, per pageloader browser
                      // instance which adds the load listener and injects tpRecordTime), all the
                      // pages should be able to load in the same mode as the initial page - due
                      // to this reinitialization on the switch.
                      if (browserWindow.gMultiProcessBrowser) {
-                       if (!firstPageCanLoadAsRemote())
+                       let remoteType = E10SUtils.getRemoteTypeForURI(pageUrls[0], true);
+                       if (remoteType) {
+                         browserWindow.XULBrowserWindow.forceInitialBrowserRemote(remoteType);
+                       } else {
                          browserWindow.XULBrowserWindow.forceInitialBrowserNonRemote(null);
-                       // Implicit else: initial browser in e10s is remote by default.
+                       }
                      }
 
                      browserWindow.resizeTo(winWidth, winHeight);
                      browserWindow.moveTo(0, 0);
                      browserWindow.focus();
 
                      content = browserWindow.getBrowser();
                      gUseE10S = !gDisableE10S || (plPageFlags() & EXECUTE_SCROLL_TEST) ||
--- a/xpfe/appshell/nsIXULBrowserWindow.idl
+++ b/xpfe/appshell/nsIXULBrowserWindow.idl
@@ -38,22 +38,21 @@ interface nsIXULBrowserWindow : nsISuppo
    * Determines the appropriate target for a link.
    */
   AString onBeforeLinkTraversal(in AString originalTarget,
                                 in nsIURI linkURI,
                                 in nsIDOMNode linkNode,
                                 in boolean isAppTab);
 
   /**
-   * Find the initial browser of the window and set its remote attribute.
-   * This can be used to ensure that there is a remote browser in a new
-   * window when it first spawns.
-   *
+   * Find the initial browser of the window and set its remote attributes.
+   * This can be used to ensure that there is a browser in a new window of the
+   * correct type when it first spawns.
    */
-  nsITabParent forceInitialBrowserRemote();
+  void forceInitialBrowserRemote(in AString aRemoteType);
   void forceInitialBrowserNonRemote(in mozIDOMWindowProxy openerWindow);
 
   /**
    * Determines whether a load should continue.
    *
    * @param aDocShell
    *        The docshell performing the load.
    * @param aURI