Bug 1472212 - Handle navigation away from privileged content process in RDM. r=jryans
☠☠ backed out by 9a4b8f268757 ☠ ☠
authorJay Lim <jlim@mozilla.com>
Fri, 20 Jul 2018 18:40:44 -0400
changeset 489214 55c2a8d227dc91f965718aa09da9811cff0969a7
parent 489213 a8bba29ad2cb20239b87081f77cdf34249d3337b
child 489215 a28443371b944ee00b1267dd5b9a22da6d28353b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjryans
bugs1472212
milestone64.0a1
Bug 1472212 - Handle navigation away from privileged content process in RDM. r=jryans Author: J. Ryan Stinnett <jryans@gmail.com> Now that we are running about:home in the privileged content process, clicking on a link in Activity Stream while having RDM activated will close the RDM because a process flip will occur. This causes the following tests to time out because the RDM has been deactivated: - devtools/client/responsive.html/test/browser/browser_container_tab.js - devtools/client/responsive.html/test/browser/browser_preloaded_newtab.js This patch disables RDM in about:home and will load about:blank instead when RDM is enabled. MozReview-Commit-ID: D5EMyfkOM8l
devtools/client/responsive.html/browser/swap.js
--- a/devtools/client/responsive.html/browser/swap.js
+++ b/devtools/client/responsive.html/browser/swap.js
@@ -101,30 +101,42 @@ function swapToInnerBrowser({ tab, conta
       browser.loadURI(uri, options);
     });
   }
 
   return {
 
     async start() {
       // In some cases, such as a preloaded browser used for about:newtab, browser code
-      // will force a new frameloader on next navigation to ensure balanced process
-      // assignment.  If this case will happen here, navigate to about:blank first to get
-      // this out of way so that we stay within one process while RDM is open.
-      const { newFrameloader } = E10SUtils.shouldLoadURIInBrowser(
-        tab.linkedBrowser,
-        "about:blank"
+      // will force a new frameloader on next navigation to remote content to ensure
+      // balanced process assignment.  If this case will happen here, navigate to
+      // about:blank first to get this out of way so that we stay within one process while
+      // RDM is open. Some process selection rules are specific to remote content, so we
+      // use `http://example.com` as a test for what a remote navigation would cause.
+      const {
+        requiredRemoteType,
+        mustChangeProcess,
+        newFrameloader
+      } = E10SUtils.shouldLoadURIInBrowser(
+         tab.linkedBrowser,
+        "http://example.com"
       );
       if (newFrameloader) {
         debug(`Tab will force a new frameloader on navigation, load about:blank first`);
         await loadURIWithNewFrameLoader(tab.linkedBrowser, "about:blank", {
           flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY,
           triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
         });
       }
+      if (mustChangeProcess) {
+        debug(`Tab will force a process flip on navigation, load about:blank first`);
+        gBrowser.updateBrowserRemoteness(tab.linkedBrowser, true, {
+          remoteType: requiredRemoteType,
+        });
+      }
 
       tab.isResponsiveDesignMode = true;
 
       // Hide the browser content temporarily while things move around to avoid displaying
       // strange intermediate states.
       tab.linkedBrowser.style.visibility = "hidden";
 
       // Freeze navigation temporarily to avoid "blinking" in the location bar.