1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("h2 shouldn't receive any blocked events, and h3 should open after h2 is open");
7 indexedDBTest(prepareDatabase, openAnother);
8 function prepareDatabase()
10 evalAndLog("versionChangeComplete = false");
11 evalAndLog("h2Opened = false");
14 function openAnother(evt)
17 evalAndLog("h1 = event.target.result");
18 h1.onversionchange = unexpectedVersionChangeCallback;
19 request = evalAndLog("indexedDB.open(dbname, 2)");
20 request.onblocked = unexpectedBlockedCallback;
21 request.onerror = unexpectedErrorCallback;
22 request.onupgradeneeded = h2UpgradeNeeded;
23 request.onsuccess = h2Success;
25 request = evalAndLog("indexedDB.open(dbname)");
26 request.onblocked = unexpectedBlockedCallback;
27 request.onerror = unexpectedErrorCallback;
28 request.onupgradeneeded = unexpectedUpgradeNeededCallback;
29 request.onsuccess = h3Success;
30 evalAndLog("h1.close()");
33 function h2UpgradeNeeded(evt)
36 evalAndLog("h2 = event.target.result");
37 h2.onversionchange = unexpectedVersionChangeCallback;
38 transaction = event.target.transaction;
39 transaction.onabort = unexpectedAbortCallback;
40 transaction.oncomplete = function transactionOnComplete(evt) {
42 evalAndLog("versionChangeComplete = true");
46 function h2Success(evt)
49 evalAndLog("h2Opened = true");
52 function h3Success(evt)
55 evalAndLog("h3 = event.target.result");
56 shouldBe("h3.version", "2");
57 shouldBeTrue("versionChangeComplete");
58 shouldBeTrue("h2Opened");