diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/tests/browser/browser_allocateGigabyte.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/browser/browser_allocateGigabyte.js')
-rw-r--r-- | dom/tests/browser/browser_allocateGigabyte.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dom/tests/browser/browser_allocateGigabyte.js b/dom/tests/browser/browser_allocateGigabyte.js new file mode 100644 index 000000000..b291afe49 --- /dev/null +++ b/dom/tests/browser/browser_allocateGigabyte.js @@ -0,0 +1,43 @@ +/* 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 = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); + 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, /* weak = */ false); + }); +} + +add_task(function*() { + yield SpecialPowers.pushPrefEnv({ + set: [ + ["dom.largeAllocationHeader.enabled", true], + ] + }); + + // A toplevel tab should be able to navigate cross process! + yield BrowserTestUtils.withNewTab("about:blank", function*(aBrowser) { + let epc = expectProcessCreated(); + yield ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => { + content.document.location = TEST_URI; + }); + + // Wait for the new process to be created by the Large-Allocation header + yield epc; + + // Allocate a gigabyte of memory in the content process + yield ContentTask.spawn(aBrowser, null, () => { + let arrayBuffer = new ArrayBuffer(1024*1024*1024); + ok(arrayBuffer, "Successfully allocated a gigabyte of memory in content process"); + }); + }); +}); |