| <html> |
| <head> |
| <script src="../resources/worker-util.js"></script> |
| <script> |
| var worker; |
| |
| function log(message) |
| { |
| document.getElementById("console").innerHTML += message + "<br>"; |
| } |
| |
| function finishTest() |
| { |
| log("PASS: database operations interrupted."); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| function terminateWorker() |
| { |
| worker.terminate(); |
| waitUntilWorkerThreadsExit(finishTest) |
| } |
| |
| function runTest() |
| { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| worker = new Worker('resources/interrupt-database.js'); |
| worker.onmessage = function(event) { |
| if (event.data == "terminate") |
| terminateWorker(); |
| else |
| log(event.data); |
| }; |
| } |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| This test makes sure that all async database operations are immediately interrupted when the worker needs to terminate. |
| <pre id="console"> |
| </pre> |
| </body> |
| </html> |