Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / pending-version-change-stuck-works-with-terminate.html
blob81c5d63bb7cc57bcdc39d3e658cc49ffeb747c77
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="resources/shared.js"></script>
5 </head>
6 <body>
7 <script>
9 description("Explicitly terminating worker with blocked call should allow later open calls to proceed");
11 function test()
13 setDBNameFromPath();
14 if (self.location.search !== "?second") {
15 firstOpen();
16 } else {
17 secondOpen();
21 function firstOpen() {
22 request = evalAndLog("indexedDB.deleteDatabase(dbname)");
23 request.onblocked = unexpectedBlockedCallback;
24 request.onerror = unexpectedErrorCallback;
25 request.onsuccess = function() {
26 request = evalAndLog("indexedDB.open(dbname)");
27 request.onblocked = unexpectedBlockedCallback;
28 request.onerror = unexpectedErrorCallback;
29 request.onsuccess = startTheWorker;
33 function secondOpen() {
34 request = evalAndLog("indexedDB.open(dbname)");
35 request.onblocked = unexpectedBlockedCallback;
36 request.onerror = unexpectedErrorCallback;
37 request.onupgradeneeded = unexpectedUpgradeNeededCallback;
38 request.onsuccess = function() {
39 testPassed("Open worked after page reload.");
40 finishJSTest();
44 function startTheWorker()
46 worker = startWorker("resources/pending-version-change-stuck.js?" + encodeURIComponent(dbname));
47 worker.onerror = function(e) {
48 testFailed(e.message);
49 finishJSTest();
51 originalOnMessage = worker.onmessage;
52 worker.onmessage = function(event) {
53 if (event.data == "gotblocked") {
54 worker.terminate();
55 self.location = self.location + "?second";
56 return;
59 originalOnMessage(event);
63 test();
65 </script>
66 </body>
67 </html>