2017-02-01 15:34:24 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
Test that the preallocated process starts up.
|
|
|
|
-->
|
|
|
|
<head>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2017-02-01 15:34:24 +03:00
|
|
|
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
2017-02-23 00:10:07 +03:00
|
|
|
<script type="application/javascript">
|
2017-02-01 15:34:24 +03:00
|
|
|
"use strict";
|
2018-12-13 03:45:24 +03:00
|
|
|
/* eslint-env mozilla/frame-script */
|
2017-02-01 15:34:24 +03:00
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
function expectProcessCreated() {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
function parentExpectProcessCreated() {
|
2019-01-17 21:18:31 +03:00
|
|
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
2017-02-01 15:34:24 +03:00
|
|
|
let topic = "ipc:content-initializing";
|
2018-12-13 03:43:55 +03:00
|
|
|
let obs = { observe() {
|
2017-02-01 15:34:24 +03:00
|
|
|
Services.obs.removeObserver(obs, topic);
|
2018-12-13 03:43:55 +03:00
|
|
|
sendAsyncMessage("process-created");
|
|
|
|
}};
|
2017-04-14 22:51:38 +03:00
|
|
|
Services.obs.addObserver(obs, topic);
|
2017-02-01 15:34:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
let helper = SpecialPowers.loadChromeScript(parentExpectProcessCreated);
|
2018-12-13 03:43:55 +03:00
|
|
|
SimpleTest.registerCleanupFunction(function() { helper.destroy(); });
|
|
|
|
helper.addMessageListener("process-created", resolve);
|
2017-02-01 15:34:24 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
expectProcessCreated().then(() => {
|
|
|
|
ok(true, "Process creation detected.");
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Kill existing preallocated process.
|
2018-12-13 03:43:55 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processPrelaunch.enabled", false]]}).then(() => {
|
2017-02-01 15:34:24 +03:00
|
|
|
// Make sure we have the capacity to launch preallocated process.
|
2018-12-13 03:43:55 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", 100]]}).then(() => {
|
2017-02-01 15:34:24 +03:00
|
|
|
// Enable preallocated process and run the test.
|
2018-12-13 03:43:55 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processPrelaunch.enabled", true]]});
|
2017-02-01 15:34:24 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|