Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>data URL shared worker</title> | 2 <title>data URL shared worker</title> |
| 3 <script src="/resources/testharness.js"></script> | 3 <script src="/resources/testharness.js"></script> |
| 4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
| 5 <div id=log></div> | 5 <div id=log></div> |
| 6 <script> | 6 <script> |
| 7 function assert_worker_sends_pass(test_desc, mime_type, worker_code) { | 7 function assert_worker_sends_pass(test_desc, mime_type, worker_code) { |
| 8 async_test(function(t) { | 8 async_test(function(t) { |
| 9 var w = new SharedWorker(`data:${mime_type},onconnect = function(e) { port = e.ports[0]; ${worker_code}}`); | 9 var w = new SharedWorker(`data:${mime_type},onconnect = function(e) { port = e.ports[0]; ${worker_code}}`); |
| 10 w.port.onmessage = t.step_func_done(function(e) { | 10 w.port.onmessage = t.step_func_done(function(e) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 // Any MIME type allowed | 21 // Any MIME type allowed |
| 22 assert_worker_sends_pass('application/javascript MIME allowed', 'application/jav ascript', 'port.postMessage("PASS")'); | 22 assert_worker_sends_pass('application/javascript MIME allowed', 'application/jav ascript', 'port.postMessage("PASS")'); |
| 23 assert_worker_sends_pass('text/plain MIME allowed', 'text/plain', 'port.postMess age("PASS")'); | 23 assert_worker_sends_pass('text/plain MIME allowed', 'text/plain', 'port.postMess age("PASS")'); |
| 24 assert_worker_sends_pass('empty MIME allowed', '', 'port.postMessage("PASS")'); | 24 assert_worker_sends_pass('empty MIME allowed', '', 'port.postMessage("PASS")'); |
| 25 | 25 |
| 26 // Communications goes both ways | 26 // Communications goes both ways |
| 27 assert_worker_sends_pass('communication goes both ways', 'application/javascript ', 'port.onmessage = function(e) { port.postMessage("PASS"); }'); | 27 assert_worker_sends_pass('communication goes both ways', 'application/javascript ', 'port.onmessage = function(e) { port.postMessage("PASS"); }'); |
| 28 | 28 |
| 29 // 'data:' workers are cross-origin | 29 // 'data:' workers are cross-origin |
| 30 assert_worker_throws('indexedDB inaccessible', 'self.indexedDB.open("someDBName" )'); | 30 assert_worker_throws('indexedDB inaccessible', 'self.indexedDB.open("someDBName" )'); |
| 31 assert_worker_throws('localStorage inaccessible', 'self.localStorage.testItem'); | |
| 32 assert_worker_sends_pass('cross-origin worker', '', 'fetch("/").then(() => port. postMessage("FAIL"), () => port.postMessage("PASS"))'); | 31 assert_worker_sends_pass('cross-origin worker', '', 'fetch("/").then(() => port. postMessage("FAIL"), () => port.postMessage("PASS"))'); |
| 32 assert_worker_throws('websql inaccessible', 'self.openDatabase("someDBName", "1. 0", "someDBName", 1);'); | |
|
jochen (gone - plz use gerrit)
2017/02/15 08:50:41
the official name is WebDatabase
andypaicu2
2017/02/15 09:10:54
Changed name to the title in the specs: Web SQL Da
| |
| 33 | 33 |
| 34 // 'data:' workers have opaque origin | 34 // 'data:' workers have opaque origin |
| 35 assert_worker_sends_pass('worker has opaque origin', 'application/javascript', ' if (self.location.origin == "null") port.postMessage("PASS"); else port.postMess age("FAIL");'); | 35 assert_worker_sends_pass('worker has opaque origin', 'application/javascript', ' if (self.location.origin == "null") port.postMessage("PASS"); else port.postMess age("FAIL");'); |
| 36 </script> | 36 </script> |
| OLD | NEW |