forked from mirrors/gecko-dev
test_WorkerDebugger_frozen.xhtml had 2 bad things happening:
- It wasn't using `add_task` so thrown exceptions would not propagate to
the test framework; the test is now modernized to use add_task.
- waitForMultiple was requiring an ordering which did not hold and the
test had even been changed in a place to use `Promise.all()` already
because of this. waitForMultiple has been changed to Promise.all()
because this seems to have been a systemic error. In the cases where
the ordering dependency was fine like pairs of waitForUnregister()
and waitForDebuggerClose(), the specific ordering was meaningless.
- I did not change all call-sites for blame reasons and to avoid
perturbing the linter further.
Differential Revision: https://phabricator.services.mozilla.com/D191822
72 lines
2.4 KiB
HTML
72 lines
2.4 KiB
HTML
<?xml version="1.0"?>
|
|
<!--
|
|
Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/
|
|
-->
|
|
<window title="Test for WorkerDebugger with frozen workers"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
|
<script type="application/javascript" src="dom_worker_helper.js"/>
|
|
|
|
<script type="application/javascript">
|
|
<![CDATA[
|
|
|
|
const WINDOW1_URL = "WorkerDebugger_frozen_window1.html";
|
|
const WINDOW2_URL = "WorkerDebugger_frozen_window2.html";
|
|
|
|
const WORKER1_URL = "WorkerDebugger_frozen_worker1.js";
|
|
const WORKER2_URL = "WorkerDebugger_frozen_worker2.js";
|
|
|
|
add_task(
|
|
async function runTest() {
|
|
await SpecialPowers.pushPrefEnv({set:
|
|
[["browser.sessionhistory.max_total_viewers", 10]]});
|
|
|
|
let promise = waitForMultiple([
|
|
waitForRegister(WORKER1_URL),
|
|
waitForWindowMessage(window, "ready"),
|
|
]);
|
|
let testWin = window.open(WINDOW1_URL, "testWin");;
|
|
let [dbg1] = await promise;
|
|
is(dbg1.isClosed, false,
|
|
"debugger for worker on page 1 should not be closed");
|
|
|
|
promise = waitForMultiple([
|
|
waitForUnregister(WORKER1_URL),
|
|
waitForDebuggerClose(dbg1),
|
|
waitForRegister(WORKER2_URL),
|
|
waitForWindowMessage(window, "ready"),
|
|
]);
|
|
testWin.location = WINDOW2_URL;
|
|
let [,, dbg2] = await promise;
|
|
is(dbg1.isClosed, true,
|
|
"debugger for worker on page 1 should be closed");
|
|
is(dbg2.isClosed, false,
|
|
"debugger for worker on page 2 should not be closed");
|
|
|
|
promise = Promise.all([
|
|
waitForUnregister(WORKER2_URL),
|
|
waitForDebuggerClose(dbg2),
|
|
waitForRegister(WORKER1_URL)
|
|
]);
|
|
testWin.history.back();
|
|
[,, dbg1] = await promise;
|
|
is(dbg1.isClosed, false,
|
|
"debugger for worker on page 1 should not be closed");
|
|
is(dbg2.isClosed, true,
|
|
"debugger for worker on page 2 should be closed");
|
|
}
|
|
);
|
|
|
|
]]>
|
|
</script>
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
|
<p id="display"></p>
|
|
<div id="content" style="display:none;"></div>
|
|
<pre id="test"></pre>
|
|
</body>
|
|
<label id="test-result"/>
|
|
</window>
|