OLD | NEW |
1 <!-- | 1 <!-- |
2 /* | 2 /* |
3 --> | 3 --> |
4 <!doctype html> | 4 <!doctype html> |
5 <title>same-origin checks</title> | 5 <title>same-origin checks</title> |
6 <link rel=help href="http://www.whatwg.org/html/#dom-sharedworker"> | 6 <link rel=help href="http://www.whatwg.org/html/#dom-sharedworker"> |
7 <script src="/resources/testharness.js"></script> | 7 <script src="/resources/testharness.js"></script> |
8 <script src="/resources/testharnessreport.js"></script> | 8 <script src="/resources/testharnessreport.js"></script> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
11 // Needed to prevent a race condition if a worker throws an exception that may o
r may | 11 // Needed to prevent a race condition if a worker throws an exception that may o
r may |
12 // not propogate to the window before the tests finish | 12 // not propogate to the window before the tests finish |
13 setup({allow_uncaught_exception: true}); | 13 setup({allow_uncaught_exception: true}); |
14 | 14 |
15 function testSharedWorkerHelper(t, script) { | 15 function testSharedWorkerHelper(t, script) { |
16 try { | 16 try { |
17 var worker = new SharedWorker(script, ''); | 17 var worker = new SharedWorker(script, ''); |
18 worker.onerror = t.step_func_done(function(e) { | 18 worker.onerror = t.step_func_done(function(e) { |
19 assert_true(e instanceof ErrorEvent); | 19 assert_true(e instanceof Event); |
20 }); | 20 }); |
21 } catch (e) { | 21 } catch (e) { |
22 t.step_func_done(function(e) { assert_true(true); }); | 22 t.step_func_done(function(e) { assert_true(true); }); |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 test(function() { | 26 test(function() { |
27 assert_throws("SecurityError", function() { new SharedWorker('unsupported:', '
'); }); | 27 assert_throws("SecurityError", function() { new SharedWorker('unsupported:', '
'); }); |
28 }, "unsupported_scheme"); | 28 }, "unsupported_scheme"); |
29 | 29 |
(...skipping 28 matching lines...) Expand all Loading... |
58 testSharedWorkerHelper(this, 'https://'+location.hostname+':8000/'); | 58 testSharedWorkerHelper(this, 'https://'+location.hostname+':8000/'); |
59 }, "https_port_8000"); | 59 }, "https_port_8000"); |
60 | 60 |
61 async_test(function(t) { | 61 async_test(function(t) { |
62 testSharedWorkerHelper(this, 'http://'+location.hostname+':8012/'); | 62 testSharedWorkerHelper(this, 'http://'+location.hostname+':8012/'); |
63 }, "http_port_8012"); | 63 }, "http_port_8012"); |
64 </script> | 64 </script> |
65 <!-- | 65 <!-- |
66 */ | 66 */ |
67 //--> | 67 //--> |
OLD | NEW |