2 <p>Test Worker constructor functionality. Should print a series of PASS messages, followed with DONE.</p>
7 document.getElementById("result").innerHTML += message + "<br>";
10 function runNextTest()
13 if (testIndex > totalTests) {
15 if (window.layoutTestController)
16 layoutTestController.notifyDone();
18 eval("test" + testIndex + "();");
25 new Worker({toString:function(){throw "exception"}})
26 log("FAIL: toString exception not propagated.");
28 if (ex == "exception")
29 log("PASS: toString exception propagated correctly.");
31 log("FAIL: unexpected exception (" + ex + ") received instead of one propagated from toString.");
39 var foo = {toString:function(){new Worker(foo)}}
41 log("FAIL: no exception when trying to create workers recursively");
43 log("PASS: trying to create workers recursively resulted in an exception (" + ex + ")");
52 log("FAIL: invoking Worker constructor without arguments did not result in an exception");
54 log("PASS: invoking Worker constructor without arguments resulted in an exception (" + ex + ")");
62 var worker = new Worker("");
63 worker.onerror = function() {
64 log("PASS: onerror invoked for an empty script URL.");
68 log("FAIL: unexpected exception " + ex);
76 var worker = new Worker("invalidurl://");
77 worker.onerror = function() {
78 log("PASS: onerror invoked for an invalid script URL.");
82 log("FAIL: unexpected exception " + ex);
90 var worker = new Worker("does-not-exist.js");
91 worker.onerror = function() {
92 log("PASS: onerror invoked for a script that could not be loaded.");
96 log("FAIL: unexpected exception " + ex);
101 if (window.layoutTestController) {
102 layoutTestController.dumpAsText();
103 layoutTestController.waitUntilDone();