Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/workers/worker-allow-data-url.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/workers/worker-allow-data-url.html b/third_party/WebKit/LayoutTests/http/tests/workers/worker-allow-data-url.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1bbed27dcc38569dcfd060fdcaf7274ef785df42 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/workers/worker-allow-data-url.html |
| @@ -0,0 +1,45 @@ |
| +<!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
|
| +<title>Test workers can be started with a data URL</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script> |
| +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
|
| + w = new Worker('data:application/javascript,onmessage = function(e) {postMessage("PASS");}'); |
| + w.onmessage = t.step_func_done(function(e) { |
| + assert_equals(e.data, 'PASS'); |
| + }); |
| + w.postMessage('Please Pass'); |
| +}, 'Basic data Worker check'); |
| + |
| +async_test(function(t) { |
| + w = new Worker('DaTA:application/javascript,onmessage = function(e) {postMessage("PASS");}'); |
| + w.onmessage = t.step_func_done(function(e) { |
| + assert_equals(e.data, 'PASS'); |
| + }); |
| + w.postMessage('Please Pass'); |
| +}, 'Case-insensitive protocol Worker check'); |
| + |
| +async_test(function(t) { |
| + assert_throws(null, new Worker('data:application/javascript,postMessage(localStorage.testItem)'), 'Should not be able to access local storage'); |
| + t.done(); |
| +}, 'Test access to local storage'); |
| + |
| +async_test(function(t) { |
| + assert_throws(null, new Worker('data:application/javascript,postMessage(indexedDB.open("bug270979"))'), 'Should not be able to access indexedDB'); |
| + t.done(); |
| +}, 'Test access to indexedDB'); |
| + |
| +async_test(function(t) { |
| + w = new Worker('data:application/javascript,postMessage(location.origin)'); |
| + w.onmessage = t.step_func_done(function(e) { |
| + assert_equals(e.data, 'null'); |
| + }); |
| +}, 'Test worker origin'); |
| + |
| +async_test(function(t) { |
| + assert_throws('SecurityError', |
| + function() { w = new Worker('http://example.test:8000/test.js'); }, |
| + 'Still can not create ordinary cross-origin worker'); |
| + t.done(); |
| +}, 'Still can not create ordinary cross-origin worker'); |
| +</script> |