Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / shared-worker-script-error.html
blobdf5c7f1393655d2d789a4064377e1e550a13ec48
1 <body>
2 <p>Test SharedWorker script error handling functionality. Should print a series of PASS messages, followed with DONE.</p>
3 <div id=result></div>
4 <script>
5 function log(message)
7 document.getElementById("result").innerHTML += message + "<br>";
10 var testCases = [
11 "testScriptErrorUnhandled",
12 "testScriptErrorHandled"
14 var testIndex = 0;
16 function runNextTest()
18 if (testIndex < testCases.length) {
19 testIndex++;
20 try {
21 window[testCases[testIndex - 1]]();
22 } catch (ex) {
23 log("FAIL: unexpected exception " + ex);
24 runNextTest();
26 } else {
27 log("DONE");
28 // Wait briefly to make sure that any pending console messages get written out so they don't spill over into subsequent tests and cause failures.
29 setTimeout(function() {
30 if (window.testRunner)
31 testRunner.notifyDone();
32 }, 10);
36 function testScriptErrorUnhandled()
38 var worker = new SharedWorker("resources/shared-worker-script-error.js", "name");
39 // SharedWorkers should only invoke onerror for loading errors.
40 worker.onerror = function(evt) {
41 log("FAIL: onerror invoked for a script error");
43 worker.port.postMessage("unhandledError");
44 worker.port.onmessage = function(evt) {
45 log(evt.data);
46 runNextTest();
50 function testScriptErrorHandled()
52 var worker = new SharedWorker("resources/shared-worker-script-error.js", "name2");
53 // SharedWorkers should only invoke onerror for loading errors.
54 worker.onerror = function(evt) {
55 log("FAIL: onerror invoked for a script error");
57 worker.port.postMessage("handledError");
58 worker.port.onmessage = function(evt) {
59 log(evt.data);
60 runNextTest();
64 if (window.testRunner) {
65 testRunner.dumpAsText();
66 testRunner.waitUntilDone();
69 runNextTest();
71 </script>
72 </body>