1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * Any copyright is dedicated to the Public Domain.
4 * http://creativecommons.org/licenses/publicdomain/
5 * Contributor: Jason Orendorff <jorendorff@mozilla.com>
8 if (typeof Worker != 'undefined') {
9 JSTest.waitForExplicitFinish();
11 // This tests that a parent worker can terminate a child. We run the test
12 // several times serially. If terminate() doesn't work, the runaway Workers
13 // will soon outnumber the number of threads in the thread pool, and we
19 reportCompare(0, 0, "worker-terminate");
20 JSTest.testFinished();
24 var w = new Worker(workerDir + "worker-terminate-child.js");
25 w.onmessage = function (event) {
26 reportCompare("killed", event.data, "killed runaway worker #" + i);
29 w.onerror = function (event) {
30 reportCompare(0, 1, "Got error: " + event.message);
32 w.postMessage(workerDir);
36 reportCompare(0, 0, "Test skipped. Shell workers required.");