1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("Test that integer versions are encoded/decoded consistently.");
12 9007199254740991]; // 2^53-1, maximum JavaScript integer.
17 request = evalAndLog("indexedDB.deleteDatabase(dbname)");
18 request.onblocked = unexpectedBlockedCallback;
19 request.onerror = unexpectedErrorCallback;
20 request.onsuccess = openFirstTime;
23 function openFirstTime(evt) {
26 if (!versions.length) {
31 evalAndLog("version = " + versions.shift());
32 evalAndLog("upgradeNeededFired = false");
33 evalAndLog("request = indexedDB.open(dbname, version)");
34 request.onblocked = unexpectedBlockedCallback;
35 request.onerror = unexpectedErrorCallback;
36 request.onupgradeneeded = function() {
37 evalAndLog("upgradeNeededFired = true");
38 evalAndLog("db = request.result");
39 shouldBe("db.version", "version");
41 request.onsuccess = function() {
42 shouldBeTrue("upgradeNeededFired");
43 evalAndLog("db = request.result");
44 shouldBe("db.version", "version");
45 evalAndLog("db.close()");
50 function openSecondTime() {
52 evalAndLog("request = indexedDB.open(dbname)");
53 request.onblocked = unexpectedBlockedCallback;
54 request.onerror = unexpectedErrorCallback;
55 request.onupgradeneeded = unexpectedUpgradeNeededCallback;
56 request.onsuccess = function() {
57 evalAndLog("db = request.result");
58 shouldBe("db.version", "version");
59 evalAndLog("db.close()");