Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / websocket / workers / worker-shutdown-race.html
1 <!DOCTYPE html>
2 <div id="result"></div>
3 <script>
4 // This is a regression test for crbug.com/341754
5 if (window.testRunner) {
6     testRunner.dumpAsText();
7     testRunner.waitUntilDone();
8 }
9
10 if (document.location.hash.match(/done/)) {
11     document.getElementById("result").innerHTML = "Done.";
12     testRunner.notifyDone();
13 } else {
14     var w = new Worker("resources/worker-create-ws.js");
15     var start = new Date() - 0;
16     // Wait 300ms without allowing any tasks to run. This gives time for the
17     // Worker to be created and post a task to create the WebSocket on the main
18     // thread, without actually letting that task be executed.
19     while (new Date() - start < 300) {}
20     // Cause the Worker to be destroyed.
21     location.hash = "done";
22     location.reload();
23 }
24 </script>