Skip to content

Instantly share code, notes, and snippets.

@jryans
Created July 16, 2018 23:03
Show Gist options
  • Save jryans/dff8a50e37f36f1b7a08233b64fe4bc8 to your computer and use it in GitHub Desktop.
Save jryans/dff8a50e37f36f1b7a08233b64fe4bc8 to your computer and use it in GitHub Desktop.
commit aa1a809e3a474ea789eddd6977fa1b20d7ff38d7
Author: J. Ryan Stinnett <jryans@gmail.com>
Date: Mon Jul 16 18:01:44 2018 -0500
Handle navigation away from privileged content process in RDM
diff --git a/devtools/client/responsive.html/browser/swap.js b/devtools/client/responsive.html/browser/swap.js
index 863101963ee0a..e7e5b75f16514 100644
--- a/devtools/client/responsive.html/browser/swap.js
+++ b/devtools/client/responsive.html/browser/swap.js
@@ -97,29 +97,41 @@ function swapToInnerBrowser({ tab, containerURL, getInnerBrowser }) {
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(
+ // 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,
- "about:blank"
+ "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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment