1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("Test that integer versions are reverted when their version transactions abort.");
12 request = evalAndLog("indexedDB.deleteDatabase(dbname)");
13 request.onsuccess = deleteSuccess;
14 request.onerror = unexpectedErrorCallback;
17 function deleteSuccess(evt) {
18 evalAndLog("request = indexedDB.open(dbname, 2)");
19 request.onsuccess = openSuccess;
20 request.onerror = unexpectedErrorCallback;
21 request.onblocked = unexpectedBlockedCallback;
22 request.onupgradeneeded = firstUpgradeNeededCallback;
25 function firstUpgradeNeededCallback(evt)
28 evalAndLog("db = event.target.result");
29 evalAndLog("db.createObjectStore('some os')");
32 function openSuccess(evt)
35 evalAndLog("db = event.target.result");
36 shouldBe("db.version", "2");
37 evalAndLog("db.close()");
38 evalAndLog("request = indexedDB.open(dbname, 3)");
39 evalAndLog("request.onupgradeneeded = secondUpgradeNeededCallback");
40 evalAndLog("request.onerror = errorAfterAbortCallback");
41 request.onsuccess = unexpectedSuccessCallback;
42 request.onblocked = unexpectedBlockedCallback;
45 function secondUpgradeNeededCallback(evt)
48 evalAndLog("db = event.target.result");
49 evalAndLog("db.createObjectStore('some os 2')");
50 evalAndLog("event.target.transaction.abort()");
53 function errorAfterAbortCallback(evt)
56 shouldBe("db.version", "2");
57 evalAndLog("request = indexedDB.open(dbname)");
58 evalAndLog("request.onsuccess = finalSuccessCallback");
59 request.onerror = unexpectedErrorCallback;
60 request.onblocked = unexpectedBlockedCallback;
61 request.onupgradeneeded = unexpectedUpgradeNeededCallback;
64 function finalSuccessCallback(evt)
67 evalAndLog("db = event.target.result");
68 shouldBe("db.version", "2");
69 shouldBe("db.objectStoreNames.length", "1");
70 shouldBeEqualToString("db.objectStoreNames[0]", "some os");