Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / pending-version-change-on-exit.html
blob63b124f1ad3d9ef62a8904ed46a1f5f4981765ef
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("No crashes when there are event listeners in a worker on shutdown");
11 if (self.location.search == "?second") {
12 testPassed("Didn't crash!");
13 finishJSTest();
14 } else {
15 evalAndLog("workerGotBlocked = false");
16 evalAndLog("gotVersionChangeEvent = false");
17 indexedDBTest(prepareDatabase, startTheWorker);
20 function prepareDatabase()
22 debug("inside prepareDatabase");
23 preamble();
24 db = event.target.result;
25 db.onversionchange = onVersionChange;
28 function startTheWorker()
30 worker = startWorker("resources/pending-version-change-on-exit.js?" + encodeURIComponent(dbname));
31 realFinishJSTest = finishJSTest;
32 worker.onerror = function(e) {
33 testFailed(e.message);
34 realFinishJSTest();
36 finishJSTest = function() {
37 workerGotBlocked = true;
38 maybeReload();
42 function onVersionChange(e)
44 gotVersionChangeEvent = true;
45 maybeReload();
48 function maybeReload()
50 if (gotVersionChangeEvent && workerGotBlocked)
51 self.location = self.location + "?second";
54 </script>
55 </body>
56 </html>