| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../resources/worker-util.js"></script> | |
| 4 <script> | |
| 5 var worker; | |
| 6 | |
| 7 function log(message) | |
| 8 { | |
| 9 document.getElementById("console").innerHTML += message + "<br>"; | |
| 10 } | |
| 11 | |
| 12 function finishTest() | |
| 13 { | |
| 14 log("PASS: database operations interrupted."); | |
| 15 if (window.testRunner) | |
| 16 testRunner.notifyDone(); | |
| 17 } | |
| 18 | |
| 19 function terminateWorker() | |
| 20 { | |
| 21 worker.terminate(); | |
| 22 waitUntilWorkerThreadsExit(finishTest) | |
| 23 } | |
| 24 | |
| 25 function runTest() | |
| 26 { | |
| 27 if (window.testRunner) { | |
| 28 testRunner.dumpAsText(); | |
| 29 testRunner.waitUntilDone(); | |
| 30 } | |
| 31 | |
| 32 worker = new Worker('resources/interrupt-database.js'); | |
| 33 worker.onmessage = function(event) { | |
| 34 if (event.data == "terminate") | |
| 35 terminateWorker(); | |
| 36 else | |
| 37 log(event.data); | |
| 38 }; | |
| 39 } | |
| 40 </script> | |
| 41 </head> | |
| 42 | |
| 43 <body onload="runTest()"> | |
| 44 This test makes sure that all async database operations are immediately interrup
ted when the worker needs to terminate. | |
| 45 <pre id="console"> | |
| 46 </pre> | |
| 47 </body> | |
| 48 </html> | |
| OLD | NEW |