OLD | NEW |
| (Empty) |
1 <!-- | |
2 for (;) // should cause onerror to be invoked, but onerror is null, so | |
3 // the error is "not handled". should fire an ErrorEvent on the | |
4 // worker. | |
5 break; | |
6 postMessage(1); // shouldn't do anything since the script doesn't compile | |
7 /* | |
8 --> | |
9 <!doctype html> | |
10 <title>AbstractWorker.onerror</title> | |
11 <link rel=help href="https://html.spec.whatwg.org/multipage/#runtime-script-erro
rs-2"> | |
12 <link rel=help href="https://html.spec.whatwg.org/multipage/#report-the-error"> | |
13 <link rel=help href="https://html.spec.whatwg.org/multipage/#the-event-handler-p
rocessing-algorithm"> | |
14 <script src="/resources/testharness.js"></script> | |
15 <script src="/resources/testharnessreport.js"></script> | |
16 <div id="log"></div> | |
17 <script> | |
18 setup({allow_uncaught_exception:true}); | |
19 async_test(function() { | |
20 var worker = new Worker('#'); | |
21 var error; | |
22 worker.onerror = this.step_func(function(a, b, c) { | |
23 error = a; | |
24 assert_equals('' + a, '[object ErrorEvent]'); | |
25 assert_true("message" in a, 'ErrorEvent.message'); | |
26 assert_equals(typeof a.message, "string", 'ErrorEvent.message'); | |
27 assert_equals(a.filename, document.URL + '#', 'ErrorEvent.filename'); | |
28 assert_true("lineno" in a, 'ErrorEvent.lineno'); | |
29 assert_equals(typeof a.lineno, "number", 'ErrorEvent.lineno'); | |
30 assert_equals(b, undefined, 'unexpected second argument to onerror'); | |
31 assert_equals(c, undefined, 'unexpected third argument to onerror'); | |
32 }); | |
33 worker.onmessage = this.step_func(function(e) { | |
34 assert_unreached('onmessage was invoked but worker script shouldn\'t have co
mpiled'); | |
35 }); | |
36 window.onerror = this.step_func_done(function(a, b, c, d, e, f) { | |
37 assert_equals(a, error.message, 'message'); | |
38 assert_equals(b, error.filename, 'filename'); | |
39 assert_equals(c, error.lineno, 'lineno'); | |
40 assert_equals(d, error.colno, 'colno'); | |
41 assert_equals(e, error.error, 'error'); | |
42 assert_equals(f, undefined, 'unexpected sixth argument to onerror'); | |
43 }); | |
44 }); | |
45 </script> | |
46 <!-- | |
47 */ | |
48 //--> | |
OLD | NEW |