зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1598759 - Remove support for Large-Allocation HTTP header. r=nika,fluent-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D140459
This commit is contained in:
Родитель
e8a03fa4da
Коммит
809cd2a13e
|
@ -60,7 +60,6 @@ const SUPPORTED_HEADERS = [
|
|||
"If-Range",
|
||||
"If-Unmodified-Since",
|
||||
"Keep-Alive",
|
||||
"Large-Allocation",
|
||||
"Last-Modified",
|
||||
"Location",
|
||||
"Origin",
|
||||
|
|
|
@ -1928,12 +1928,11 @@ CanonicalBrowsingContext::ChangeRemoteness(
|
|||
|
||||
// If we're aiming to end up in a new process of the same type as our old
|
||||
// process, and then putting our previous document in the BFCache, try to stay
|
||||
// in the same process to avoid creating new processes unnecessarially.
|
||||
// in the same process to avoid creating new processes unnecessarily.
|
||||
RefPtr<ContentParent> existingProcess = GetContentParent();
|
||||
if (existingProcess && existingProcess->IsAlive() &&
|
||||
aOptions.mReplaceBrowsingContext &&
|
||||
aOptions.mRemoteType == existingProcess->GetRemoteType() &&
|
||||
aOptions.mRemoteType != LARGE_ALLOCATION_REMOTE_TYPE) {
|
||||
aOptions.mRemoteType == existingProcess->GetRemoteType()) {
|
||||
change->mContentParent = existingProcess;
|
||||
change->mContentParent->AddKeepAlive();
|
||||
change->ProcessLaunched();
|
||||
|
@ -2591,12 +2590,6 @@ bool CanonicalBrowsingContext::AllowedInBFCache(
|
|||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString remoteType;
|
||||
GetCurrentRemoteType(remoteType, IgnoredErrorResult());
|
||||
if (remoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t bfcacheCombo = 0;
|
||||
if (mRestoreState) {
|
||||
bfcacheCombo |= BFCacheStatus::RESTORING;
|
||||
|
|
|
@ -870,7 +870,7 @@ static WebIDLProcType ProcTypeToWebIDL(mozilla::ProcType aType) {
|
|||
PROCTYPE_TO_WEBIDL_CASE(PrivilegedMozilla, Privilegedmozilla);
|
||||
PROCTYPE_TO_WEBIDL_CASE(WebCOOPCOEP, WithCoopCoep);
|
||||
PROCTYPE_TO_WEBIDL_CASE(WebServiceWorker, WebServiceWorker);
|
||||
PROCTYPE_TO_WEBIDL_CASE(WebLargeAllocation, WebLargeAllocation);
|
||||
|
||||
#define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, proc_typename, \
|
||||
process_bin_type, procinfo_typename, \
|
||||
webidl_typename, allcaps_name) \
|
||||
|
@ -885,6 +885,7 @@ static WebIDLProcType ProcTypeToWebIDL(mozilla::ProcType aType) {
|
|||
# undef SKIP_PROCESS_TYPE_FORKSERVER
|
||||
#endif // MOZ_ENABLE_FORKSERVER
|
||||
#undef GECKO_PROCESS_TYPE
|
||||
|
||||
PROCTYPE_TO_WEBIDL_CASE(Preallocated, Preallocated);
|
||||
PROCTYPE_TO_WEBIDL_CASE(Unknown, Unknown);
|
||||
}
|
||||
|
@ -1036,8 +1037,6 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
|
|||
type = mozilla::ProcType::PrivilegedAbout;
|
||||
} else if (remoteType == PRIVILEGEDMOZILLA_REMOTE_TYPE) {
|
||||
type = mozilla::ProcType::PrivilegedMozilla;
|
||||
} else if (remoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
|
||||
type = mozilla::ProcType::WebLargeAllocation;
|
||||
} else if (remoteType == PREALLOC_REMOTE_TYPE) {
|
||||
type = mozilla::ProcType::Preallocated;
|
||||
} else if (StringBeginsWith(remoteType, DEFAULT_REMOTE_TYPE)) {
|
||||
|
|
|
@ -618,7 +618,6 @@ enum WebIDLProcType {
|
|||
"extension",
|
||||
"privilegedabout",
|
||||
"privilegedmozilla",
|
||||
"webLargeAllocation",
|
||||
"withCoopCoep",
|
||||
"webServiceWorker",
|
||||
"browser",
|
||||
|
|
|
@ -33,7 +33,6 @@ Diagram
|
|||
<TR><TD BORDER="1">Shared Web Content<BR/>(<FONT FACE="monospace">web</FONT>)</TD></TR>
|
||||
<TR><TD BORDER="1">Isolated Web Content<BR/>(<FONT FACE="monospace">webIsolated=$SITE</FONT>)</TD></TR>
|
||||
<TR><TD BORDER="1">COOP+COEP Web Content<BR/>(<FONT FACE="monospace">webCOOP+COEP=$SITE</FONT>)</TD></TR>
|
||||
<TR><TD BORDER="1">Large Allocation Web Content<BR/>(<FONT FACE="monospace">webLargeAlloc</FONT>)</TD></TR>
|
||||
<TR><TD BORDER="1">ServiceWorker Web Content<BR/>(<FONT FACE="monospace">webServiceWorker</FONT>)</TD></TR>
|
||||
</TABLE>
|
||||
>
|
||||
|
@ -206,17 +205,6 @@ Like Isolated Web Content, these processes are keyed by the site loaded within t
|
|||
|
||||
In ``about:processes``, COOP+COEP Web Content processes will be listed with a "cross-origin isolated" note after the PID, like ``https://example.com (12345, cross-origin isolated)``.
|
||||
|
||||
Large Allocation Web Content
|
||||
""""""""""""""""""""""""""""
|
||||
|
||||
:remoteType: ``webLargeAlloc``
|
||||
:default count: 10 (``dom.ipc.processCount.webLargeAlloc``)
|
||||
:platform: 32-bit Windows only (``dom.largeAllocation.forceEnable``)
|
||||
|
||||
Document loads with the non-standard ``Large-Allocation`` header are requesting to be placed into a separate content process such that they can have access to a less-fragmented address space. This was originally designed to enable 32-bit Windows platforms to load and run asm.js and wasm code more easily.
|
||||
|
||||
This header is only supported on 32-bit Windows, and will likely be removed in the near future.
|
||||
|
||||
ServiceWorker Web Content
|
||||
""""""""""""""""""""
|
||||
|
||||
|
@ -225,7 +213,6 @@ ServiceWorker Web Content
|
|||
|
||||
ServiceWorker web content processes are used to host ServiceWorkers on a per-site basis, so that ServiceWorker operations aren't impacted by MainThread event latency whenrunning in the same process as the content for the page. ServiceWorkers are usually transitory, and will disappear if unused for a short period of time.
|
||||
|
||||
|
||||
Gecko Media Plugins (GMP) Process
|
||||
---------------------------------
|
||||
|
||||
|
|
|
@ -99,8 +99,6 @@ in the following circumstances, though this may change in the future:
|
|||
- When switching processes between the parent process, and a content process.
|
||||
- When loading an extension document in a toplevel browsing context.
|
||||
- When navigating away from a preloaded ``about:newtab`` document.
|
||||
- Sometimes, when loading a document with the ``Large-Allocation`` header on
|
||||
32-bit windows.
|
||||
- When putting a ``BrowsingContext`` into BFCache for the session history
|
||||
in-parent BFCache implementation. This will happen on most toplevel
|
||||
navigations without opener relationships when the ``fission.bfcacheInParent``
|
||||
|
|
|
@ -2737,8 +2737,6 @@ mozilla::ipc::IPCResult ContentChild::RecvRemoteType(
|
|||
SetProcessName("WebExtensions"_ns);
|
||||
} else if (aRemoteType == PRIVILEGEDABOUT_REMOTE_TYPE) {
|
||||
SetProcessName("Privileged Content"_ns);
|
||||
} else if (aRemoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
|
||||
SetProcessName("Large Allocation Web Content"_ns);
|
||||
} else if (remoteTypePrefix == WITH_COOP_COEP_REMOTE_TYPE) {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
SetProcessName("WebCOOP+COEP Content"_ns);
|
||||
|
|
|
@ -740,8 +740,7 @@ const nsDependentCSubstring RemoteTypePrefix(
|
|||
}
|
||||
|
||||
bool IsWebRemoteType(const nsACString& aContentProcessType) {
|
||||
// Note: matches webIsolated as well as web (and webLargeAllocation, and
|
||||
// webCOOP+COEP)
|
||||
// Note: matches webIsolated, web, and webCOOP+COEP types.
|
||||
return StringBeginsWith(aContentProcessType, DEFAULT_REMOTE_TYPE);
|
||||
}
|
||||
|
||||
|
@ -1052,15 +1051,6 @@ ContentParent::GetNewOrUsedLaunchingBrowserProcess(
|
|||
|
||||
nsTArray<ContentParent*>& contentParents = GetOrCreatePool(aRemoteType);
|
||||
uint32_t maxContentParents = GetMaxProcessCount(aRemoteType);
|
||||
// We never want to re-use Large-Allocation processes.
|
||||
if (aRemoteType == LARGE_ALLOCATION_REMOTE_TYPE &&
|
||||
contentParents.Length() >= maxContentParents) {
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("GetNewOrUsedProcess: returning Large Used process"));
|
||||
return GetNewOrUsedLaunchingBrowserProcess(DEFAULT_REMOTE_TYPE, aGroup,
|
||||
aPriority,
|
||||
/*aPreferUsed =*/false);
|
||||
}
|
||||
|
||||
// Let's try and reuse an existing process.
|
||||
contentParent = GetUsedBrowserProcess(
|
||||
|
|
|
@ -382,38 +382,6 @@ static already_AddRefed<BasePrincipal> GetAboutReaderURLPrincipal(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given load has the `Large-Allocation` header set, and the header
|
||||
* is enabled.
|
||||
*/
|
||||
static bool IsLargeAllocationLoad(CanonicalBrowsingContext* aBrowsingContext,
|
||||
nsIChannel* aChannel) {
|
||||
if (!StaticPrefs::dom_largeAllocationHeader_enabled() ||
|
||||
aBrowsingContext->UseRemoteSubframes()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
if (!httpChannel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString ignoredHeaderValue;
|
||||
nsresult rv =
|
||||
httpChannel->GetResponseHeader("Large-Allocation"_ns, ignoredHeaderValue);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// On all platforms other than win32, LargeAllocation is disabled by default,
|
||||
// and has to be force-enabled using `dom.largeAllocation.forceEnable`.
|
||||
#if defined(XP_WIN) && defined(_X86_)
|
||||
return true;
|
||||
#else
|
||||
return StaticPrefs::dom_largeAllocation_forceEnable();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if loads for this site should be isolated on a per-site basis.
|
||||
* If `aTopBC` is nullptr, this is being called to check if a shared or service
|
||||
|
@ -776,30 +744,6 @@ Result<NavigationIsolationOptions, nsresult> IsolationOptionsForNavigation(
|
|||
options.mReplaceBrowsingContext = true;
|
||||
}
|
||||
|
||||
// Handle the deprecated Large-Allocation header.
|
||||
if (!aTopBC->UseRemoteSubframes()) {
|
||||
MOZ_ASSERT(!aParentWindow,
|
||||
"subframe switch when `UseRemoteSubframes()` is false?");
|
||||
bool singleToplevel = aTopBC->Group()->Toplevels().Length() == 1;
|
||||
bool isLargeAllocLoad = IsLargeAllocationLoad(aTopBC, aChannel);
|
||||
// If we're starting a large-alloc load and have no opener relationships,
|
||||
// force the load to finish in the large-allocation remote type.
|
||||
if (isLargeAllocLoad && singleToplevel) {
|
||||
options.mRemoteType = LARGE_ALLOCATION_REMOTE_TYPE;
|
||||
options.mReplaceBrowsingContext = true;
|
||||
return options;
|
||||
}
|
||||
if (aCurrentRemoteType == LARGE_ALLOCATION_REMOTE_TYPE) {
|
||||
// If we're doing a non-large-alloc load, we may still need to finish in
|
||||
// the large-allocation remote type if we have opener relationships.
|
||||
if (!singleToplevel) {
|
||||
options.mRemoteType = LARGE_ALLOCATION_REMOTE_TYPE;
|
||||
return options;
|
||||
}
|
||||
options.mReplaceBrowsingContext = true;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoCString siteOriginNoSuffix;
|
||||
MOZ_TRY(resultOrPrecursor->GetSiteOriginNoSuffix(siteOriginNoSuffix));
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#define FISSION_WEB_REMOTE_TYPE "webIsolated"_ns
|
||||
#define WITH_COOP_COEP_REMOTE_TYPE "webCOOP+COEP"_ns
|
||||
#define WITH_COOP_COEP_REMOTE_TYPE_PREFIX "webCOOP+COEP="_ns
|
||||
#define LARGE_ALLOCATION_REMOTE_TYPE "webLargeAllocation"_ns
|
||||
#define SERVICEWORKER_REMOTE_TYPE "webServiceWorker"_ns
|
||||
|
||||
// Remote type value used to represent being non-remote.
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const TESTFRAME_QUERY_LARGE_ALLOCATION_WITH_NO_CSP = `<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1555050 - Test CSP Navigation using ReloadInFreshProcess</title>
|
||||
</head>
|
||||
<body>
|
||||
testframe<br/>
|
||||
<script>
|
||||
// we have to use noopener otherwise the window is not the only window in the tabgroup which is needed
|
||||
// for "Large-Allocation" to succeed
|
||||
window.open("http://test1.example.com/tests/dom/security/test/csp/file_reloadInFreshProcess.sjs?largeAllocation_with_no_csp", "_blank", "noopener");
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
const TESTFRAME_QUERY_LARGE_ALLOCATION_WITH_CSP = `<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1555050 - Test CSP Navigation using ReloadInFreshProcess</title>
|
||||
</head>
|
||||
<body>
|
||||
testframe<br/>
|
||||
<script>
|
||||
// we have to use noopener otherwise the window is not the only window in the tabgroup which is needed
|
||||
// for "Large-Allocation" to succeed
|
||||
window.open("http://test2.example.com/tests/dom/security/test/csp/file_reloadInFreshProcess.sjs?largeAllocation_with_csp", "_blank", "noopener");
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
const LARGE_ALLOCATION = `<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1555050 - Test CSP Navigation using ReloadInFreshProcess</title>
|
||||
</head>
|
||||
<body>
|
||||
largeAllocation<br/>
|
||||
<script>
|
||||
window.close();
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
function handleRequest(request, response) {
|
||||
// avoid confusing cache behaviors
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
|
||||
var queryString = request.queryString;
|
||||
|
||||
if (queryString == "testframe_with_csp") {
|
||||
response.setHeader(
|
||||
"Content-Security-Policy",
|
||||
"upgrade-insecure-requests",
|
||||
false
|
||||
);
|
||||
response.write(TESTFRAME_QUERY_LARGE_ALLOCATION_WITH_NO_CSP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (queryString == "testframe_with_no_csp") {
|
||||
response.write(TESTFRAME_QUERY_LARGE_ALLOCATION_WITH_CSP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (queryString == "largeAllocation_with_csp") {
|
||||
response.setHeader(
|
||||
"Content-Security-Policy",
|
||||
"upgrade-insecure-requests",
|
||||
false
|
||||
);
|
||||
response.setHeader("Large-Allocation", "0", false);
|
||||
response.write(LARGE_ALLOCATION);
|
||||
return;
|
||||
}
|
||||
|
||||
if (queryString == "largeAllocation_with_no_csp") {
|
||||
response.setHeader("Large-Allocation", "0", false);
|
||||
response.write(LARGE_ALLOCATION);
|
||||
return;
|
||||
}
|
||||
|
||||
// we should never get here, but just in case return something unexpected
|
||||
response.write("do'h");
|
||||
}
|
|
@ -413,12 +413,6 @@ support-files =
|
|||
support-files =
|
||||
file_script_template.html
|
||||
file_script_template.js
|
||||
[test_reloadInFreshProcess.html]
|
||||
# no e10s-multi support on android and no large-allocation on win32
|
||||
skip-if =
|
||||
(toolkit == 'android') || (os == 'win' && bits == 32)
|
||||
support-files =
|
||||
file_reloadInFreshProcess.sjs
|
||||
[test_parent_location_js.html]
|
||||
support-files =
|
||||
file_parent_location_js.html
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1555050: Test CSP Navigation using ReloadInFreshProcess</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<iframe style="width:100%;" id="testframe_with_csp"></iframe>
|
||||
<iframe style="width:100%;" id="testframe_with_no_csp"></iframe>
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/*
|
||||
* Description of the tests:
|
||||
*
|
||||
* | Frame | Large Allocation Window | Result
|
||||
* -----------------------------------------------------------------------------
|
||||
* Test 1 | "upgrade-insecure-requests" | | https
|
||||
* Test 2 | | "upgrade-insecure-requests" | http
|
||||
*
|
||||
* Test 1:
|
||||
* We load an iframe which uses 'upgrade-insecure-requests' which then opens an
|
||||
* "http" window which uses the header "Large-Allocation". We observe that the
|
||||
* request gets upgraded to use "https://test1.example.com".
|
||||
*
|
||||
* Test 2:
|
||||
* We load an iframe which does not use any CSP and opens an "http" window
|
||||
* which uses the header "Large-Allocation" as well as a CSP of
|
||||
* "upgrade-insecure-requests". We observe that the request does not get
|
||||
* upgraded to https but still uses "http://test2.example.com".
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let httpsCounter = 0;
|
||||
let httpCounter = 0;
|
||||
|
||||
function checkTestComplete() {
|
||||
if (httpsCounter == 1 && httpCounter == 1) {
|
||||
ok(true, "Frame with CSP caused upgrade; Frame with no CSP caused no upgrade");
|
||||
window.URLExaminer.remove();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe(subject, topic, data) {
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
if (data === "https://test1.example.com/tests/dom/security/test/csp/file_reloadInFreshProcess.sjs?largeAllocation_with_no_csp") {
|
||||
httpsCounter++;
|
||||
checkTestComplete();
|
||||
return;
|
||||
}
|
||||
if (data === "http://test2.example.com/tests/dom/security/test/csp/file_reloadInFreshProcess.sjs?largeAllocation_with_csp") {
|
||||
httpCounter++;
|
||||
checkTestComplete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
remove() {
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
window.URLExaminer = new examiner();
|
||||
|
||||
function runTest() {
|
||||
let testframe_with_csp = document.getElementById("testframe_with_csp");
|
||||
testframe_with_csp.src = "http://test1.example.com/tests/dom/security/test/csp/file_reloadInFreshProcess.sjs?testframe_with_csp";
|
||||
|
||||
let testframe_with_no_csp = document.getElementById("testframe_with_no_csp");
|
||||
testframe_with_no_csp.src = "http://test2.example.com/tests/dom/security/test/csp/file_reloadInFreshProcess.sjs?testframe_with_no_csp";
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.largeAllocation.forceEnable", true]]}, runTest);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -14,18 +14,9 @@ support-files =
|
|||
geo_leak_test.html
|
||||
dummy.html
|
||||
dummy.png
|
||||
test_largeAllocation.html
|
||||
test_largeAllocation.html^headers^
|
||||
test_largeAllocation2.html
|
||||
test_largeAllocation2.html^headers^
|
||||
test_largeAllocationFormSubmit.sjs
|
||||
helper_largeAllocation.js
|
||||
helper_localStorage.js
|
||||
!/dom/tests/mochitest/geolocation/network_geolocation.sjs
|
||||
|
||||
[browser_allocateGigabyte.js]
|
||||
disabled = Does not reliably pass on 32-bit systems - bug 1314098
|
||||
skip-if = !e10s
|
||||
[browser_autofocus_background.js]
|
||||
[browser_autofocus_preference.js]
|
||||
[browser_beforeunload_between_chrome_content.js]
|
||||
|
@ -72,17 +63,6 @@ support-files =
|
|||
skip-if =
|
||||
os == "linux" && bits == 64 # Bug 1742012
|
||||
os == "win" && debug # Bug 1742012
|
||||
[browser_largeAllocation_win32.js]
|
||||
https_first_disabled = true
|
||||
skip-if = fission
|
||||
!e10s
|
||||
os != "win"
|
||||
processor != "x86" # Large-Allocation requires non-fission e10s
|
||||
[browser_largeAllocation_non_win32.js]
|
||||
https_first_disabled = true
|
||||
skip-if = fission
|
||||
!e10s
|
||||
(os == "win" && processor == "x86") # Large-Allocation requires non-fission e10s
|
||||
[browser_localStorage_e10s.js]
|
||||
https_first_disabled = true
|
||||
fail-if = fission
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI =
|
||||
"http://example.com/browser/dom/tests/browser/test_largeAllocation.html";
|
||||
|
||||
function expectProcessCreated() {
|
||||
let os = Services.obs;
|
||||
return new Promise(resolve => {
|
||||
let topic = "ipc:content-created";
|
||||
function observer() {
|
||||
os.removeObserver(observer, topic);
|
||||
ok(true, "Expect process created");
|
||||
resolve();
|
||||
}
|
||||
os.addObserver(observer, topic);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.largeAllocationHeader.enabled", true]],
|
||||
});
|
||||
|
||||
// A toplevel tab should be able to navigate cross process!
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
let epc = expectProcessCreated();
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
// Wait for the new process to be created by the Large-Allocation header
|
||||
await epc;
|
||||
|
||||
// Allocate a gigabyte of memory in the content process
|
||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
let arrayBuffer = new ArrayBuffer(1024 * 1024 * 1024);
|
||||
ok(
|
||||
arrayBuffer,
|
||||
"Successfully allocated a gigabyte of memory in content process"
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,43 +0,0 @@
|
|||
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
|
||||
/* import-globals-from helper_largeAllocation.js */
|
||||
Services.scriptloader.loadSubScript(
|
||||
testDir + "/helper_largeAllocation.js",
|
||||
this
|
||||
);
|
||||
|
||||
// Force-enabling the Large-Allocation header
|
||||
add_task(async function() {
|
||||
info("Test 1 - force enabling the Large-Allocation header");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
// Enable the header if it is disabled
|
||||
["dom.largeAllocationHeader.enabled", true],
|
||||
// Force-enable process creation with large-allocation, such that non
|
||||
// win32 builds can test the behavior.
|
||||
["dom.largeAllocation.forceEnable", true],
|
||||
// Increase processCount.webLargeAllocation to avoid any races where
|
||||
// processes aren't being cleaned up quickly enough.
|
||||
["dom.ipc.processCount.webLargeAllocation", 20],
|
||||
],
|
||||
});
|
||||
|
||||
await largeAllocSuccessTests();
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
info("Test 2 - not force enabling the Large-Allocation header");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
// Enable the header if it is disabled
|
||||
["dom.largeAllocationHeader.enabled", true],
|
||||
// Force-enable process creation with large-allocation, such that non
|
||||
// win32 builds can test the behavior.
|
||||
["dom.largeAllocation.forceEnable", false],
|
||||
// Increase processCount.webLargeAllocation to avoid any races where
|
||||
// processes aren't being cleaned up quickly enough.
|
||||
["dom.ipc.processCount.webLargeAllocation", 20],
|
||||
],
|
||||
});
|
||||
|
||||
await largeAllocFailTests();
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
|
||||
Services.scriptloader.loadSubScript(
|
||||
testDir + "/helper_largeAllocation.js",
|
||||
this
|
||||
);
|
||||
|
||||
add_task(async function() {
|
||||
info("Test 1 - On win32 - no forceEnable pref");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
// Enable the header if it is disabled
|
||||
["dom.largeAllocationHeader.enabled", true],
|
||||
// Increase processCount.webLargeAllocation to avoid any races where
|
||||
// processes aren't being cleaned up quickly enough.
|
||||
["dom.ipc.processCount.webLargeAllocation", 20],
|
||||
],
|
||||
});
|
||||
/* global largeAllocSuccessTests */
|
||||
await largeAllocSuccessTests();
|
||||
});
|
|
@ -1,600 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI =
|
||||
"http://example.com/browser/dom/tests/browser/test_largeAllocation.html";
|
||||
const TEST_URI_2 =
|
||||
"http://example.com/browser/dom/tests/browser/test_largeAllocation2.html";
|
||||
|
||||
function expectProcessCreated() {
|
||||
let os = Services.obs;
|
||||
let kill; // A kill function which will disable the promise.
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
let topic = "ipc:content-created";
|
||||
function observer() {
|
||||
os.removeObserver(observer, topic);
|
||||
ok(true, "Expect process created");
|
||||
resolve();
|
||||
}
|
||||
os.addObserver(observer, topic);
|
||||
kill = () => {
|
||||
os.removeObserver(observer, topic);
|
||||
ok(true, "Expect process created killed");
|
||||
reject();
|
||||
};
|
||||
});
|
||||
promise.kill = kill;
|
||||
return promise;
|
||||
}
|
||||
|
||||
function getPID(aBrowser) {
|
||||
return SpecialPowers.spawn(aBrowser, [], () => {
|
||||
return Services.appinfo.processID;
|
||||
});
|
||||
}
|
||||
|
||||
function getInLAProc(aBrowser) {
|
||||
return SpecialPowers.spawn(aBrowser, [], () => {
|
||||
return Services.appinfo.remoteType == "webLargeAllocation";
|
||||
});
|
||||
}
|
||||
|
||||
async function largeAllocSuccessTests() {
|
||||
// I'm terrible and put this set of tests into a single file, so I need a longer timeout
|
||||
requestLongerTimeout(4);
|
||||
|
||||
// Check if we are on win32
|
||||
let isWin32 =
|
||||
/Windows/.test(navigator.userAgent) && !/x64/.test(navigator.userAgent);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
// Enable the header if it is disabled
|
||||
["dom.largeAllocationHeader.enabled", true],
|
||||
// Force-enable process creation with large-allocation, such that non
|
||||
// win32 builds can test the behavior.
|
||||
["dom.largeAllocation.forceEnable", !isWin32],
|
||||
// Increase processCount.webLargeAllocation to avoid any races where
|
||||
// processes aren't being cleaned up quickly enough.
|
||||
["dom.ipc.processCount.webLargeAllocation", 20],
|
||||
],
|
||||
});
|
||||
|
||||
// A toplevel tab should be able to navigate cross process!
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 0");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
// Wait for the new process to be created
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(
|
||||
pid1,
|
||||
pid2,
|
||||
"The pids should be different between the initial load and the new load"
|
||||
);
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// When a Large-Allocation document is loaded in an iframe, the header should
|
||||
// be ignored, and the tab should stay in the current process.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 1");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
content.document.body.innerHTML = `<iframe src='${TEST_URI}'></iframe>`;
|
||||
|
||||
return new Promise(resolve => {
|
||||
content.document.body.querySelector("iframe").onload = () => {
|
||||
ok(true, "Iframe finished loading");
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
is(pid1, pid2, "The PID should not have changed");
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// If you have an opener cross process navigation shouldn't work
|
||||
await BrowserTestUtils.withNewTab("http://example.com", async function(
|
||||
aBrowser
|
||||
) {
|
||||
info("Starting test 2");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
info(TEST_URI);
|
||||
content.document.body.innerHTML = "<button>CLICK ME</button>";
|
||||
|
||||
return new Promise(resolve => {
|
||||
let w = content.window.open(TEST_URI, "_blank");
|
||||
w.onload = () => {
|
||||
ok(true, "Window finished loading");
|
||||
w.close();
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
is(pid1, pid2, "The PID should not have changed");
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// Load Large-Allocation twice with example.com load in between
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 3");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2);
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
content.document.location = "http://example.com";
|
||||
});
|
||||
|
||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||
|
||||
// We should have been kicked out of the large-allocation process by the
|
||||
// load, meaning we're back in a non-fresh process
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid4 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid4);
|
||||
isnot(pid2, pid4);
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// Load Large-Allocation then example.com load, then back button press should load from bfcache.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 4");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
// Switch to about:blank, so we can navigate back
|
||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
content.document.location = "http://example.com";
|
||||
});
|
||||
|
||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||
|
||||
let pid3 = await getPID(aBrowser);
|
||||
|
||||
// We should have been kicked out of the large-allocation process by the
|
||||
// load, meaning we're back in a non-large-allocation process.
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
// Navigate back to the previous page. As the large alloation process was
|
||||
// left, it won't be in bfcache and will have to be loaded fresh.
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.window.history.back();
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid4 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid4, "PID 4 shouldn't match PID 1");
|
||||
isnot(pid2, pid4, "PID 4 shouldn't match PID 2");
|
||||
isnot(pid3, pid4, "PID 4 shouldn't match PID 3");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// Two consecutive large-allocation loads should create two processes.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 5");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI_2], TEST_URI_2 => {
|
||||
content.document.location = TEST_URI_2;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid3 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid3, "PIDs 1 and 3 should not match");
|
||||
isnot(pid2, pid3, "PIDs 2 and 3 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// Opening a window from the large-allocation window should prevent the process switch.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 6");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
let promiseTabOpened = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
"about:blank"
|
||||
);
|
||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
content.window.open("about:blank");
|
||||
content.document.location = "http://example.com";
|
||||
});
|
||||
|
||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||
|
||||
let pid3 = await getPID(aBrowser);
|
||||
|
||||
is(pid3, pid2, "PIDs 2 and 3 should match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
BrowserTestUtils.removeTab(await promiseTabOpened);
|
||||
});
|
||||
|
||||
// Opening a window from the large-allocation window should prevent the
|
||||
// process switch with reload.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 6a");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
let firstTab = gBrowser.selectedTab;
|
||||
let promiseTabOpened = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
"about:blank"
|
||||
);
|
||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
content.window.open("about:blank");
|
||||
});
|
||||
let newTab = await promiseTabOpened;
|
||||
|
||||
if (firstTab != gBrowser.selectedTab) {
|
||||
firstTab = await BrowserTestUtils.switchTab(gBrowser, firstTab);
|
||||
aBrowser = firstTab.linkedBrowser;
|
||||
}
|
||||
let promiseLoad = BrowserTestUtils.browserLoaded(aBrowser);
|
||||
document.getElementById("reload-button").doCommand();
|
||||
await promiseLoad;
|
||||
|
||||
let pid3 = await getPID(aBrowser);
|
||||
|
||||
is(pid3, pid2, "PIDs 2 and 3 should match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
});
|
||||
|
||||
// Try dragging the tab into a new window when not at the maximum number of
|
||||
// Large-Allocation processes.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 7");
|
||||
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
let newWindow = await BrowserTestUtils.openNewBrowserWindow();
|
||||
|
||||
newWindow.gBrowser.adoptTab(
|
||||
gBrowser.getTabForBrowser(aBrowser),
|
||||
0,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
let newTab = newWindow.gBrowser.tabs[0];
|
||||
|
||||
is(newTab.linkedBrowser.currentURI.spec, TEST_URI);
|
||||
is(newTab.linkedBrowser.remoteType, "webLargeAllocation");
|
||||
let pid3 = await getPID(newTab.linkedBrowser);
|
||||
|
||||
is(pid2, pid3, "PIDs 2 and 3 should match");
|
||||
is(true, await getInLAProc(newTab.linkedBrowser));
|
||||
|
||||
await BrowserTestUtils.closeWindow(newWindow);
|
||||
});
|
||||
|
||||
// Try opening a new Large-Allocation document when at the max number of large
|
||||
// allocation processes.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 8");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.ipc.processCount.webLargeAllocation", 1]],
|
||||
});
|
||||
|
||||
// Loading the first Large-Allocation tab should succeed as normal
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
// The second one should load in a non-LA proc because the
|
||||
// webLargeAllocation processes have been exhausted.
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([BrowserTestUtils.browserLoaded(aBrowser)]);
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
await ready;
|
||||
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
});
|
||||
});
|
||||
|
||||
// XXX: Important - reset the process count, as it was set to 1 by the
|
||||
// previous test.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.ipc.processCount.webLargeAllocation", 20]],
|
||||
});
|
||||
|
||||
// view-source tabs should not be considered to be in a large-allocation process.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 9");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
content.document.location = "view-source:http://example.com";
|
||||
});
|
||||
|
||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
is(pid1, pid2, "The PID should not have changed");
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
});
|
||||
|
||||
// Try dragging tab into new window when at the max number of large allocation
|
||||
// processes.
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 10");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.ipc.processCount.webLargeAllocation", 1]],
|
||||
});
|
||||
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
let newWindow = await BrowserTestUtils.openNewBrowserWindow();
|
||||
|
||||
newWindow.gBrowser.adoptTab(gBrowser.getTabForBrowser(aBrowser), 0);
|
||||
let newTab = newWindow.gBrowser.tabs[0];
|
||||
|
||||
is(newTab.linkedBrowser.currentURI.spec, TEST_URI);
|
||||
is(newTab.linkedBrowser.remoteType, "webLargeAllocation");
|
||||
let pid3 = await getPID(newTab.linkedBrowser);
|
||||
|
||||
is(pid2, pid3, "PIDs 2 and 3 should match");
|
||||
is(true, await getInLAProc(newTab.linkedBrowser));
|
||||
|
||||
await BrowserTestUtils.closeWindow(newWindow);
|
||||
});
|
||||
|
||||
// XXX: Important - reset the process count, as it was set to 1 by the
|
||||
// previous test.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.ipc.processCount.webLargeAllocation", 20]],
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(aBrowser) {
|
||||
info("Starting test 11");
|
||||
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([
|
||||
expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await ready;
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, await getInLAProc(aBrowser));
|
||||
|
||||
await Promise.all([
|
||||
SpecialPowers.spawn(aBrowser, [], () => {
|
||||
content.document.querySelector("#submit").click();
|
||||
}),
|
||||
BrowserTestUtils.browserLoaded(aBrowser),
|
||||
]);
|
||||
|
||||
let innerText = await SpecialPowers.spawn(aBrowser, [], () => {
|
||||
return content.document.body.innerText;
|
||||
});
|
||||
isnot(innerText, "FAIL", "We should not have sent a get request!");
|
||||
is(
|
||||
innerText,
|
||||
"textarea=default+value&button=submit",
|
||||
"The post data should be received by the callee"
|
||||
);
|
||||
});
|
||||
|
||||
// XXX: Make sure to reset dom.ipc.processCount.webLargeAllocation if adding a
|
||||
// test after the above test.
|
||||
}
|
||||
|
||||
async function largeAllocFailTests() {
|
||||
await BrowserTestUtils.withNewTab("http://example.com", async function(
|
||||
aBrowser
|
||||
) {
|
||||
info("Starting test 1");
|
||||
let pid1 = await getPID(aBrowser);
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||
|
||||
let pid2 = await getPID(aBrowser);
|
||||
|
||||
is(pid1, pid2, "The PID should not have changed");
|
||||
is(false, await getInLAProc(aBrowser));
|
||||
});
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
Loaded in a new process!
|
||||
<form action="test_largeAllocationFormSubmit.sjs" method="POST">
|
||||
<input type="text" name="textarea" value="default value">
|
||||
<input type="submit" name="button" value="submit" id="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
Large-Allocation: 0
|
|
@ -1,4 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>Loaded in a new process!</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
Large-Allocation: 0
|
|
@ -1,27 +0,0 @@
|
|||
const BinaryInputStream = Components.Constructor(
|
||||
"@mozilla.org/binaryinputstream;1",
|
||||
"nsIBinaryInputStream",
|
||||
"setInputStream"
|
||||
);
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setHeader("Large-Allocation", "0", false);
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setStatusLine(request.httpVersion, "200", "Found");
|
||||
if (request.method == "GET") {
|
||||
response.write("FAIL");
|
||||
return;
|
||||
}
|
||||
|
||||
var body = new BinaryInputStream(request.bodyInputStream);
|
||||
|
||||
var avail;
|
||||
var bytes = [];
|
||||
|
||||
while ((avail = body.available()) > 0) {
|
||||
Array.prototype.push.apply(bytes, body.readByteArray(avail));
|
||||
}
|
||||
|
||||
var data = String.fromCharCode.apply(null, bytes);
|
||||
response.bodyOutputStream.write(data, data.length);
|
||||
}
|
|
@ -98,10 +98,6 @@ bool RemoteWorkerManager::MatchRemoteType(const nsACString& processRemoteType,
|
|||
// remoteType and here we can just assert that it is not happening.
|
||||
MOZ_ASSERT(!IsWebCoopCoepRemoteType(workerRemoteType));
|
||||
|
||||
// For similar reasons to the ones related to COOP+COEP processes,
|
||||
// we don't expect workerRemoteType to be set to a large allocation one.
|
||||
MOZ_ASSERT(workerRemoteType != LARGE_ALLOCATION_REMOTE_TYPE);
|
||||
|
||||
return processRemoteType.Equals(workerRemoteType);
|
||||
}
|
||||
|
||||
|
|
|
@ -2742,17 +2742,6 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
# Whether the Large-Allocation header is enabled.
|
||||
- name: dom.largeAllocationHeader.enabled
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
- name: dom.largeAllocation.forceEnable
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Whether "W3C Web Manifest" processing is enabled
|
||||
- name: dom.manifest.enabled
|
||||
type: bool
|
||||
|
|
|
@ -2489,9 +2489,6 @@ pref("dom.ipc.keepProcessesAlive.privilegedabout", 1);
|
|||
// Disable support for SVG
|
||||
pref("svg.disabled", false);
|
||||
|
||||
// Override default dom.ipc.processCount for some remote content process types.
|
||||
pref("dom.ipc.processCount.webLargeAllocation", 10);
|
||||
|
||||
// Disable e10s for Gecko by default. This is overridden in firefox.js.
|
||||
pref("browser.tabs.remote.autostart", false);
|
||||
|
||||
|
|
|
@ -468,10 +468,6 @@ var View = {
|
|||
fluentName = "about-processes-web-serviceworker";
|
||||
fluentArgs.origin = data.origin;
|
||||
break;
|
||||
case "webLargeAllocation":
|
||||
fluentName = "about-processes-web-large-allocation-process";
|
||||
fluentArgs.origin = data.origin;
|
||||
break;
|
||||
case "file":
|
||||
fluentName = "about-processes-file-process";
|
||||
break;
|
||||
|
@ -1341,7 +1337,6 @@ var Control = {
|
|||
// Web content comes next.
|
||||
case "webIsolated":
|
||||
case "webServiceWorker":
|
||||
case "webLargeAllocation":
|
||||
case "withCoopCoep": {
|
||||
if (windows.some(w => w.tab)) {
|
||||
return RANK_WEB_TABS;
|
||||
|
|
|
@ -45,7 +45,6 @@ enum class ProcType {
|
|||
Extension,
|
||||
PrivilegedAbout,
|
||||
PrivilegedMozilla,
|
||||
WebLargeAllocation,
|
||||
WebCOOPCOEP,
|
||||
WebServiceWorker,
|
||||
// the rest matches GeckoProcessTypes.h
|
||||
|
|
|
@ -65,10 +65,8 @@ about-processes-unknown-process = Other: { $type } ({ $pid })
|
|||
|
||||
about-processes-web-isolated-process = { $origin } ({ $pid })
|
||||
about-processes-web-serviceworker = { $origin } ({ $pid }, serviceworker)
|
||||
about-processes-web-large-allocation-process = { $origin } ({ $pid }, large)
|
||||
about-processes-with-coop-coep-process = { $origin } ({ $pid }, cross-origin isolated)
|
||||
about-processes-web-isolated-process-private = { $origin } — Private ({ $pid })
|
||||
about-processes-web-large-allocation-process-private = { $origin } — Private ({ $pid }, large)
|
||||
about-processes-with-coop-coep-process-private = { $origin } — Private ({ $pid }, cross-origin isolated)
|
||||
|
||||
## Details within processes
|
||||
|
|
|
@ -21,10 +21,6 @@ process-type-extension = Extension
|
|||
# process used to open file:// URLs
|
||||
process-type-file = Local File
|
||||
|
||||
# process used to isolate webpages that requested special
|
||||
# permission to allocate large amounts of memory
|
||||
process-type-weblargeallocation = Large Allocation
|
||||
|
||||
# process used to isolate a webpage from other web pages
|
||||
# to improve security
|
||||
process-type-webisolated = Isolated Web Content
|
||||
|
|
|
@ -80,7 +80,6 @@ const PRIVILEGEDMOZILLA_REMOTE_TYPE = "privilegedmozilla";
|
|||
const SERVICEWORKER_REMOTE_TYPE = "webServiceWorker";
|
||||
|
||||
// This must start with the WEB_REMOTE_TYPE above.
|
||||
const LARGE_ALLOCATION_REMOTE_TYPE = "webLargeAllocation";
|
||||
const DEFAULT_REMOTE_TYPE = WEB_REMOTE_TYPE;
|
||||
|
||||
// This list is duplicated between Navigator.cpp and here because navigator
|
||||
|
@ -274,7 +273,6 @@ var E10SUtils = {
|
|||
EXTENSION_REMOTE_TYPE,
|
||||
PRIVILEGEDABOUT_REMOTE_TYPE,
|
||||
PRIVILEGEDMOZILLA_REMOTE_TYPE,
|
||||
LARGE_ALLOCATION_REMOTE_TYPE,
|
||||
FISSION_WEB_REMOTE_TYPE,
|
||||
SERVICEWORKER_REMOTE_TYPE,
|
||||
|
||||
|
@ -662,17 +660,10 @@ var E10SUtils = {
|
|||
return NOT_REMOTE;
|
||||
}
|
||||
|
||||
if (
|
||||
// We don't want to launch workers in a large allocation remote type,
|
||||
// change it to the web remote type (then getRemoteTypeForURIObject
|
||||
// may change it to an isolated one).
|
||||
aPreferredRemoteType === LARGE_ALLOCATION_REMOTE_TYPE ||
|
||||
// Similarly to the large allocation remote type, we don't want to
|
||||
// launch the shared worker in a web coop+coep remote type even if
|
||||
// was registered from a frame loaded in a child process with that
|
||||
// We don't want to launch the shared worker in a web coop+coep remote type
|
||||
// even if was registered from a frame loaded in a child process with that
|
||||
// remote type.
|
||||
aPreferredRemoteType?.startsWith(WEB_REMOTE_COOP_COEP_TYPE_PREFIX)
|
||||
) {
|
||||
if (aPreferredRemoteType?.startsWith(WEB_REMOTE_COOP_COEP_TYPE_PREFIX)) {
|
||||
aPreferredRemoteType = DEFAULT_REMOTE_TYPE;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ const ProcessType = Object.freeze({
|
|||
web: "process-type-web",
|
||||
webIsolated: "process-type-webisolated",
|
||||
webServiceWorker: "process-type-webserviceworker",
|
||||
webLargeAllocation: "process-type-weblargeallocation",
|
||||
},
|
||||
|
||||
kFallback: "process-type-unknown",
|
||||
|
|
|
@ -40,7 +40,6 @@ const {
|
|||
EXTENSION_REMOTE_TYPE,
|
||||
FILE_REMOTE_TYPE,
|
||||
FISSION_WEB_REMOTE_TYPE,
|
||||
LARGE_ALLOCATION_REMOTE_TYPE,
|
||||
NOT_REMOTE,
|
||||
PRIVILEGEDABOUT_REMOTE_TYPE,
|
||||
PRIVILEGEDMOZILLA_REMOTE_TYPE,
|
||||
|
@ -54,7 +53,8 @@ const {
|
|||
REMOTE_WORKER_TYPE_SERVICE,
|
||||
} = Ci.nsIE10SUtils;
|
||||
|
||||
// Test ServiceWorker remoteType selection with multiprocess and/or site isolation enabled.
|
||||
// Test ServiceWorker remoteType selection with multiprocess and/or site
|
||||
// isolation enabled.
|
||||
add_task(function test_get_remote_type_for_service_worker() {
|
||||
// ServiceWorkers with system or null principal are unexpected and we expect
|
||||
// the method call to throw.
|
||||
|
@ -146,12 +146,12 @@ add_task(function test_get_remote_type_for_service_worker() {
|
|||
}
|
||||
});
|
||||
|
||||
// Test SharedWorker remoteType selection with multiprocess and/or site isolation enabled.
|
||||
// Test SharedWorker remoteType selection with multiprocess and/or site
|
||||
// isolation enabled.
|
||||
add_task(function test_get_remote_type_for_shared_worker() {
|
||||
// Verify that for shared worker registered from a large allocation or web
|
||||
// coop+coep remote types we are going to select a web or fission remote type.
|
||||
// Verify that for shared worker registered from a web coop+coep remote type
|
||||
// we are going to select a web or fission remote type.
|
||||
for (const [principal, preferredRemoteType] of [
|
||||
[principalSecureCom, LARGE_ALLOCATION_REMOTE_TYPE],
|
||||
[
|
||||
principalSecureCom,
|
||||
`${WEB_REMOTE_COOP_COEP_TYPE_PREFIX}=${principalSecureCom.siteOrigin}`,
|
||||
|
@ -245,7 +245,6 @@ add_task(function test_get_remote_type_for_shared_worker() {
|
|||
// Shared worker registered for web+custom urls.
|
||||
for (const [preferredRemoteType, expectedRemoteType] of [
|
||||
[WEB_REMOTE_TYPE, WEB_REMOTE_TYPE],
|
||||
[LARGE_ALLOCATION_REMOTE_TYPE, WEB_REMOTE_TYPE],
|
||||
["fakeRemoteType", "fakeRemoteType"],
|
||||
// This seems to be actually failing with a SecurityError
|
||||
// as soon as the SharedWorker constructor is being called with
|
||||
|
@ -269,7 +268,6 @@ add_task(function test_get_remote_type_for_shared_worker() {
|
|||
// Shared worker registered for ext+custom urls.
|
||||
for (const [preferredRemoteType, expectedRemoteType] of [
|
||||
[WEB_REMOTE_TYPE, WEB_REMOTE_TYPE],
|
||||
[LARGE_ALLOCATION_REMOTE_TYPE, WEB_REMOTE_TYPE],
|
||||
["fakeRemoteType", "fakeRemoteType"],
|
||||
// This seems to be actually prevented by failing a ClientIsValidPrincipalInfo
|
||||
// check (but only when the remote worker is being launched in the child process
|
||||
|
|
Загрузка…
Ссылка в новой задаче