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