| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script> | 4 <script> |
| 5 function log(message) | 5 function log(message) |
| 6 { | 6 { |
| 7 document.getElementById('console').appendChild(document.createTextNode(messa
ge + "\n")); | 7 document.getElementById('console').appendChild(document.createTextNode(messa
ge + "\n")); |
| 8 } | 8 } |
| 9 | 9 |
| 10 function runTest() | 10 function runTest() |
| 11 { | 11 { |
| 12 log("Test inline web worker via blob URL."); | 12 log("Test inline web worker via blob URL."); |
| 13 var string = [ | 13 var string = [ |
| 14 "onmessage = function(e) {", | 14 "onmessage = function(e) {", |
| 15 " postMessage('Hello from worker');", | 15 " postMessage('Hello from worker');", |
| 16 "};" | 16 "};" |
| 17 ].join('\n'); | 17 ].join('\n'); |
| 18 var blobURL = URL.createObjectURL(new Blob([string])); | 18 var blobURL = URL.createObjectURL(new Blob([string])); |
| 19 var worker = new Worker(blobURL); | 19 var worker = new Worker(blobURL); |
| 20 worker.onmessage = function(event) { | 20 worker.onmessage = function(event) { |
| 21 log(event.data); | 21 log(event.data); |
| 22 log("DONE"); | 22 log("DONE"); |
| 23 if (testRunner.notifyDone) | 23 if (testRunner.notifyDone) |
| 24 testRunner.notifyDone(); | 24 testRunner.notifyDone(); |
| 25 }; | 25 }; |
| 26 worker.postMessage(); | 26 worker.postMessage("hi"); |
| 27 } | 27 } |
| 28 | 28 |
| 29 if (window.testRunner) { | 29 if (window.testRunner) { |
| 30 testRunner.setAllowUniversalAccessFromFileURLs(false); | 30 testRunner.setAllowUniversalAccessFromFileURLs(false); |
| 31 testRunner.setAllowFileAccessFromFileURLs(true); | 31 testRunner.setAllowFileAccessFromFileURLs(true); |
| 32 testRunner.dumpAsText(); | 32 testRunner.dumpAsText(); |
| 33 testRunner.waitUntilDone(); | 33 testRunner.waitUntilDone(); |
| 34 } | 34 } |
| 35 </script> | 35 </script> |
| 36 </head> | 36 </head> |
| 37 <body onload="runTest()"> | 37 <body onload="runTest()"> |
| 38 <pre id='console'></pre> | 38 <pre id='console'></pre> |
| 39 </body> | 39 </body> |
| 40 </html> | 40 </html> |
| OLD | NEW |