3 Any copyright is dedicated to the Public Domain.
4 http://creativecommons.org/publicdomain/zero/1.0/
6 <window title=
"Test for WorkerDebuggerManager"
7 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
10 <script src=
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
11 <script type=
"application/javascript" src=
"dom_worker_helper.js"/>
13 <script type=
"application/javascript">
16 const WORKER_URL =
"WorkerDebuggerManager_worker.js";
17 const CHILD_WORKER_URL =
"WorkerDebuggerManager_childWorker.js";
20 async function runTest() {
21 info(
"Check that worker debuggers are not enumerated before they are " +
23 ok(!findDebugger(WORKER_URL),
24 "Worker debugger should not be enumerated before it is registered.");
25 ok(!findDebugger(CHILD_WORKER_URL),
26 "Child worker debugger should not be enumerated before it is " +
29 info(
"Create a worker that creates a child worker, and wait for " +
30 "their debuggers to be registered.");
31 let promise = waitForMultiple([
32 waitForRegister(WORKER_URL),
33 waitForRegister(CHILD_WORKER_URL)
35 let worker = new Worker(WORKER_URL);
36 let [dbg, childDbg] = await promise;
38 info(
"Check that worker debuggers are enumerated after they are " +
40 ok(findDebugger(WORKER_URL),
41 "Worker debugger should be enumerated after it is registered.");
42 ok(findDebugger(CHILD_WORKER_URL),
43 "Child worker debugger should be enumerated after it is " +
46 info(
"Check that worker debuggers are not closed before they are " +
48 is(dbg.isClosed, false,
49 "Worker debugger should not be closed before it is unregistered.");
50 is(childDbg.isClosed, false,
51 "Child worker debugger should not be closed before it is " +
54 info(
"Terminate the worker and the child worker, and wait for their " +
55 "debuggers to be unregistered.");
56 promise = waitForMultiple([
57 waitForUnregister(CHILD_WORKER_URL),
58 waitForUnregister(WORKER_URL),
63 info(
"Check that worker debuggers are not enumerated after they are " +
65 ok(!findDebugger(WORKER_URL),
66 "Worker debugger should not be enumerated after it is " +
68 ok(!findDebugger(CHILD_WORKER_URL),
69 "Child worker debugger should not be enumerated after it is " +
72 info(
"Check that worker debuggers are closed after they are " +
74 is(dbg.isClosed, true,
75 "Worker debugger should be closed after it is unregistered.");
76 is(childDbg.isClosed, true,
77 "Child worker debugger should be closed after it is unregistered.");
79 info(
"Check that property accesses on worker debuggers throws " +
80 "after they are closed.");
81 assertThrows(() =
> dbg.url,
82 "Property accesses on worker debugger should throw " +
83 "after it is closed.");
84 assertThrows(() =
> childDbg.url,
85 "Property accesses on child worker debugger should " +
86 "throw after it is closed.");
93 <body xmlns=
"http://www.w3.org/1999/xhtml">
95 <div id=
"content" style=
"display:none;"></div>
98 <label id=
"test-result"/>