Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
|
Mike West
2017/02/08 13:15:44
Please update the test in //LayoutTests/external/w
andypaicu2
2017/02/10 10:25:37
Done
| |
| 2 <title>Test workers can be started with a data URL</title> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script> | |
| 6 async_test(function(t) { | |
|
Mike West
2017/02/08 13:15:44
I think we can cut the repetition here by extracti
andypaicu2
2017/02/10 10:25:37
Done
| |
| 7 w = new Worker('data:application/javascript,onmessage = function(e) {postMessa ge("PASS");}'); | |
| 8 w.onmessage = t.step_func_done(function(e) { | |
| 9 assert_equals(e.data, 'PASS'); | |
| 10 }); | |
| 11 w.postMessage('Please Pass'); | |
| 12 }, 'Basic data Worker check'); | |
| 13 | |
| 14 async_test(function(t) { | |
| 15 w = new Worker('DaTA:application/javascript,onmessage = function(e) {postMessa ge("PASS");}'); | |
| 16 w.onmessage = t.step_func_done(function(e) { | |
| 17 assert_equals(e.data, 'PASS'); | |
| 18 }); | |
| 19 w.postMessage('Please Pass'); | |
| 20 }, 'Case-insensitive protocol Worker check'); | |
| 21 | |
| 22 async_test(function(t) { | |
| 23 assert_throws(null, new Worker('data:application/javascript,postMessage(localS torage.testItem)'), 'Should not be able to access local storage'); | |
| 24 t.done(); | |
| 25 }, 'Test access to local storage'); | |
| 26 | |
| 27 async_test(function(t) { | |
| 28 assert_throws(null, new Worker('data:application/javascript,postMessage(indexe dDB.open("bug270979"))'), 'Should not be able to access indexedDB'); | |
| 29 t.done(); | |
| 30 }, 'Test access to indexedDB'); | |
| 31 | |
| 32 async_test(function(t) { | |
| 33 w = new Worker('data:application/javascript,postMessage(location.origin)'); | |
| 34 w.onmessage = t.step_func_done(function(e) { | |
| 35 assert_equals(e.data, 'null'); | |
| 36 }); | |
| 37 }, 'Test worker origin'); | |
| 38 | |
| 39 async_test(function(t) { | |
| 40 assert_throws('SecurityError', | |
| 41 function() { w = new Worker('http://example.test:8000/test.js'); }, | |
| 42 'Still can not create ordinary cross-origin worker'); | |
| 43 t.done(); | |
| 44 }, 'Still can not create ordinary cross-origin worker'); | |
| 45 </script> | |
| OLD | NEW |