Bug 1472212 - Handle navigation away from privileged content process in RDM. draft
authorJay Lim <jlim@mozilla.com>
Fri, 20 Jul 2018 18:40:44 -0400
changeset 828637 eb46f9ad3306
parent 828636 49e71e9cde71
child 828638 9f15e83ed961
push id118687
push userbmo:jay@imjching.com
push dateSun, 12 Aug 2018 15:25:52 +0000
bugs1472212
milestone63.0a1
Bug 1472212 - Handle navigation away from privileged content process in RDM. 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
@@ -97,29 +97,41 @@ 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,
         });
       }
+      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.