зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472212 - Rename E10SUtils.canLoadURIInProcess to E10SUtils.canLoadURIInRemoteType and modify it to accept an E10SUtils process type instead of a nsIXULRuntime process type. r=Gijs
See next commit for more info. The idea is to use E10SUtils.canLoadURIInRemoteType to detect if a URI can load in a given E10SUtils process type. Having it to accept a nsIXULRuntime process type, which will be mapped back to an E10SUtils process type, is unnecessary. MozReview-Commit-ID: KeYkuRDyqXO --HG-- extra : rebase_source : c4f5d562657bc1ca0a2fe7c277f09add9c976975 extra : intermediate-source : b6996abc7d90edbc99d4ac0c5b9bb4a62c5ae5ae extra : source : a8bba29ad2cb20239b87081f77cdf34249d3337b
This commit is contained in:
Родитель
5921ddafcf
Коммит
a0ee0c93dd
|
@ -1,5 +1,5 @@
|
|||
const CHROME_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
const CONTENT_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
|
||||
const CHROME_PROCESS = E10SUtils.NOT_REMOTE;
|
||||
const WEB_CONTENT_PROCESS = E10SUtils.WEB_REMOTE_TYPE;
|
||||
|
||||
const CHROME = {
|
||||
id: "cb34538a-d9da-40f3-b61a-069f0b2cb9fb",
|
||||
|
@ -79,26 +79,26 @@ registerCleanupFunction(() => {
|
|||
}
|
||||
});
|
||||
|
||||
function test_url(url, chromeResult, contentResult) {
|
||||
is(E10SUtils.canLoadURIInProcess(url, CHROME_PROCESS),
|
||||
function test_url(url, chromeResult, webContentResult) {
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, CHROME_PROCESS),
|
||||
chromeResult, "Check URL in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url, CONTENT_PROCESS),
|
||||
contentResult, "Check URL in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInProcess(url + "#foo", CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", CHROME_PROCESS),
|
||||
chromeResult, "Check URL with ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url + "#foo", CONTENT_PROCESS),
|
||||
contentResult, "Check URL with ref in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with ref in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo", CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo", CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with query in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query and ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query and ref in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with query and ref in web content process.");
|
||||
}
|
||||
|
||||
add_task(async function test_chrome() {
|
||||
|
|
|
@ -32,8 +32,8 @@ function makeTest(name, startURL, startProcessIsRemote, endURL, endProcessIsRemo
|
|||
};
|
||||
}
|
||||
|
||||
const CHROME_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
const CONTENT_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
|
||||
const CHROME_PROCESS = E10SUtils.NOT_REMOTE;
|
||||
const WEB_CONTENT_PROCESS = E10SUtils.WEB_REMOTE_TYPE;
|
||||
const PATH = (getRootDirectory(gTestPath) + "test_process_flags_chrome.html").replace("chrome://mochitests", "");
|
||||
|
||||
const CHROME = "chrome://mochitests" + PATH;
|
||||
|
@ -49,25 +49,25 @@ registerCleanupFunction(() => {
|
|||
});
|
||||
|
||||
function test_url(url, chromeResult, contentResult) {
|
||||
is(E10SUtils.canLoadURIInProcess(url, CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, CHROME_PROCESS),
|
||||
chromeResult, "Check URL in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url, CONTENT_PROCESS),
|
||||
contentResult, "Check URL in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInProcess(url + "#foo", CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", CHROME_PROCESS),
|
||||
chromeResult, "Check URL with ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url + "#foo", CONTENT_PROCESS),
|
||||
contentResult, "Check URL with ref in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL with ref in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo", CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo", CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CHROME_PROCESS),
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query and ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query and ref in content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query and ref in web content process.");
|
||||
}
|
||||
|
||||
add_task(async function test_chrome() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const CHROME_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
const CONTENT_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
|
||||
const CHROME_PROCESS = E10SUtils.NOT_REMOTE;
|
||||
const WEB_CONTENT_PROCESS = E10SUtils.WEB_REMOTE_TYPE;
|
||||
|
||||
add_task(async function() {
|
||||
let url = "javascript:dosomething()";
|
||||
|
||||
ok(E10SUtils.canLoadURIInProcess(url, CHROME_PROCESS),
|
||||
ok(E10SUtils.canLoadURIInRemoteType(url, CHROME_PROCESS),
|
||||
"Check URL in chrome process.");
|
||||
ok(E10SUtils.canLoadURIInProcess(url, CONTENT_PROCESS),
|
||||
"Check URL in content process.");
|
||||
ok(E10SUtils.canLoadURIInRemoteType(url, WEB_CONTENT_PROCESS),
|
||||
"Check URL in web content process.");
|
||||
});
|
||||
|
|
|
@ -599,12 +599,8 @@ var BrowserTestUtils = {
|
|||
if (url) {
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
|
||||
// Retrieve the given browser's current process type.
|
||||
let process =
|
||||
browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
: Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
if (win.gMultiProcessBrowser &&
|
||||
!E10SUtils.canLoadURIInProcess(url, process)) {
|
||||
!E10SUtils.canLoadURIInRemoteType(url, browser.remoteType)) {
|
||||
await this.waitForEvent(browser, "XULFrameLoaderCreated");
|
||||
}
|
||||
|
||||
|
@ -647,14 +643,10 @@ var BrowserTestUtils = {
|
|||
return;
|
||||
}
|
||||
|
||||
// Retrieve the given browser's current process type.
|
||||
let process = browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
: Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
|
||||
// If the new URI can't load in the browser's current process then we
|
||||
// should wait for the new frameLoader to be created. This will happen
|
||||
// asynchronously when the browser's remoteness changes.
|
||||
if (!E10SUtils.canLoadURIInProcess(uri, process)) {
|
||||
if (!E10SUtils.canLoadURIInRemoteType(uri, browser.remoteType)) {
|
||||
await this.waitForEvent(browser, "XULFrameLoaderCreated");
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
ChromeUtils.import("resource://gre/modules/Timer.jsm", this);
|
||||
|
||||
const TEST_PAGE_URI = "data:text/html;charset=utf-8,The letter s.";
|
||||
// Using 'javascript' schema to bypass E10SUtils.canLoadURIInProcess, because
|
||||
// Using 'javascript' schema to bypass E10SUtils.canLoadURIInRemoteType, because
|
||||
// it does not allow 'data:' URI to be loaded in the parent process.
|
||||
const E10S_PARENT_TEST_PAGE_URI = "javascript:document.write('The letter s.');";
|
||||
|
||||
|
|
|
@ -90,10 +90,14 @@ var E10SUtils = {
|
|||
PRIVILEGED_REMOTE_TYPE,
|
||||
LARGE_ALLOCATION_REMOTE_TYPE,
|
||||
|
||||
canLoadURIInProcess(aURL, aProcess) {
|
||||
let remoteType = aProcess == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
? DEFAULT_REMOTE_TYPE : NOT_REMOTE;
|
||||
return remoteType == this.getRemoteTypeForURI(aURL, true, remoteType);
|
||||
canLoadURIInRemoteType(aURL, aRemoteType = DEFAULT_REMOTE_TYPE) {
|
||||
// We need a strict equality here because the value of `NOT_REMOTE` is
|
||||
// `null`, and there is a possibility that `undefined` is passed as the
|
||||
// second argument, which might result a load in the parent process.
|
||||
let preferredRemoteType = aRemoteType === NOT_REMOTE
|
||||
? NOT_REMOTE
|
||||
: DEFAULT_REMOTE_TYPE;
|
||||
return aRemoteType == this.getRemoteTypeForURI(aURL, true, preferredRemoteType);
|
||||
},
|
||||
|
||||
getRemoteTypeForURI(aURL, aMultiProcess,
|
||||
|
|
|
@ -3081,10 +3081,9 @@ var gDetailView = {
|
|||
let policy = ExtensionParent.WebExtensionPolicy.getByID(this._addon.id);
|
||||
browser.sameProcessAsFrameLoader = policy.extension.groupFrameLoader;
|
||||
}
|
||||
let remote = !E10SUtils.canLoadURIInProcess(optionsURL, Services.appinfo.PROCESS_TYPE_DEFAULT);
|
||||
|
||||
let readyPromise;
|
||||
if (remote) {
|
||||
if (E10SUtils.canLoadURIInRemoteType(optionsURL, E10SUtils.EXTENSION_REMOTE_TYPE)) {
|
||||
browser.setAttribute("remote", "true");
|
||||
browser.setAttribute("remoteType", E10SUtils.EXTENSION_REMOTE_TYPE);
|
||||
readyPromise = promiseEvent("XULFrameLoaderCreated", browser);
|
||||
|
|
Загрузка…
Ссылка в новой задаче