OLD | NEW |
| (Empty) |
1 <!-- | |
2 var port; | |
3 var timeout; | |
4 addEventListener('error', function(e) { | |
5 // event is not canceled, thus the error is "not handled" | |
6 // so error should be reported to the user, but this test doesn't check | |
7 // that. | |
8 // just make sure that this event has the right properties | |
9 clearTimeout(timeout); | |
10 var log = ''; | |
11 if (!self.ErrorEvent || Object.getPrototypeOf(e) != ErrorEvent.prototype) | |
12 log += 'event should be an ErrorEvent. '; | |
13 if (e.bubbles) | |
14 log += 'event should not bubble. '; | |
15 if (!e.cancelable) | |
16 log += 'event should be cancelable. '; | |
17 if (!e.isTrusted) | |
18 log += 'event should be trusted. '; | |
19 if (typeof e.message != 'string') | |
20 log += 'message wasn\'t a string. '; | |
21 if (e.filename != location.href) | |
22 log += 'filename was ' + e.filename + ', expected ' + location.href + '. '; | |
23 if (typeof e.lineno != 'number') | |
24 log += 'lineno wasn\'t a number. '; | |
25 if (typeof e.colno != 'number') | |
26 log += 'colno argument wasn\'t a number. '; | |
27 if (e.error != 42) | |
28 log += 'fifth argument wasn\'t the thrown exception. '; | |
29 port.postMessage(log); | |
30 }, false); | |
31 onconnect = function (e) { | |
32 port = e.ports[0]; | |
33 timeout = setTimeout(function() { port.postMessage('No error event fired'); },
250); | |
34 throw 42; // will "report the error" | |
35 } | |
36 | |
37 | |
38 /* | |
39 --> | |
40 <!doctype html> | |
41 <title>shared worker, addEventListener</title> | |
42 <script src="/resources/testharness.js"></script> | |
43 <script src="/resources/testharnessreport.js"></script> | |
44 <div id=log></div> | |
45 <script> | |
46 setup({allow_uncaught_exception:true}); | |
47 async_test(function() { | |
48 window.onerror = this.step_func(function(a) { | |
49 assert_unreached('window.onerror invoked: ' + a); | |
50 }); | |
51 var worker = new SharedWorker('#', ''); | |
52 worker.port.onmessage = this.step_func_done(function(e) { | |
53 assert_equals(e.data, ''); | |
54 }); | |
55 }); | |
56 </script> | |
57 <!-- | |
58 */ | |
59 //--> | |
OLD | NEW |