| <!DOCTYPE html> |
| <html> |
| <head> |
| <script> |
| function log(message) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
| } |
| |
| function runTest() |
| { |
| log("Test inline web worker via blob URL."); |
| var string = [ |
| "onmessage = function(e) {", |
| " postMessage('Hello from worker');", |
| "};" |
| ].join('\n'); |
| var blobURL = URL.createObjectURL(new Blob([string])); |
| var worker = new Worker(blobURL); |
| worker.onmessage = function(event) { |
| log(event.data); |
| log("DONE"); |
| if (testRunner.notifyDone) |
| testRunner.notifyDone(); |
| }; |
| worker.postMessage("message"); |
| } |
| |
| if (window.testRunner) { |
| testRunner.setAllowUniversalAccessFromFileURLs(false); |
| testRunner.setAllowFileAccessFromFileURLs(true); |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <pre id='console'></pre> |
| </body> |
| </html> |