mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-09-10 11:54:40 +00:00
70 lines
2.0 KiB
HTML
70 lines
2.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
Test if Nuwa process created successfully.
|
|
-->
|
|
<head>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body onload="setup()">
|
|
|
|
<script type="application/javascript;version=1.7">
|
|
"use strict";
|
|
|
|
function runTest()
|
|
{
|
|
info("Shut down processes by disabling process prelaunch");
|
|
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', false);
|
|
|
|
info("Launch the Nuwa process");
|
|
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
|
|
.getService(SpecialPowers.Ci.nsISyncMessageSender);
|
|
let seenNuwaReady = false;
|
|
let msgHandler = {
|
|
receiveMessage: function receiveMessage(msg) {
|
|
msg = SpecialPowers.wrap(msg);
|
|
if (msg.name == 'TEST-ONLY:nuwa-ready') {
|
|
is(seenNuwaReady, false, "The Nuwa process is launched");
|
|
seenNuwaReady = true;
|
|
} else if (msg.name == 'TEST-ONLY:nuwa-add-new-process') {
|
|
ok(true, "Got nuwa-add-new-process");
|
|
is(seenNuwaReady, true, "The preallocated process is launched from the Nuwa process");
|
|
shutdown();
|
|
}
|
|
}
|
|
};
|
|
|
|
function shutdown() {
|
|
info("Shut down the test case");
|
|
cpmm.removeMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
|
|
cpmm.removeMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
cpmm.addMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
|
|
cpmm.addMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
|
|
|
|
|
|
// Setting this pref to true should cause us to prelaunch a process.
|
|
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', true);
|
|
}
|
|
|
|
function setup()
|
|
{
|
|
info("Set up preferences for testing the Nuwa process.");
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
SpecialPowers.pushPrefEnv({
|
|
'set': [
|
|
['dom.ipc.preallocatedProcessManager.testMode', true],
|
|
['dom.ipc.processPrelaunch.testMode', true] // For testing deadlock
|
|
]
|
|
}, runTest);
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|