2 <script src=
"../../resources/js-test.js"></script>
3 <script src=
"resources/shared.js"></script>
6 description("Regression test to ensure that IndexedDB connections don't leak");
10 indexedDB
.deleteDatabase(dbname
)
13 function doFirstOpen()
17 evalAndLog("request = indexedDB.open(dbname, 1)");
18 evalAndLog("sawUpgradeNeeded1 = false");
19 request
.onerror
= unexpectedErrorCallback
;
20 request
.onblocked
= unexpectedBlockedCallback
;
21 request
.onupgradeneeded
= function onUpgradeNeeded1() {
23 evalAndLog("sawUpgradeNeeded1 = true");
25 request
.onsuccess
= function onOpenSuccess1() {
27 shouldBeTrue("sawUpgradeNeeded1");
28 evalAndLog("db = request.result");
29 evalAndLog("db.close()");
35 function doSecondOpen()
39 evalAndLog("request = indexedDB.open(dbname, 1)");
40 request
.onerror
= unexpectedErrorCallback
;
41 request
.onblocked
= unexpectedBlockedCallback
;
42 request
.onupgradeneeded
= unexpectedUpgradeNeededCallback
;
43 request
.onsuccess
= function onOpenSuccess2() {
45 evalAndLog("db = request.result");
47 evalAndLog("db = null");
48 evalAndLog("request = null");
50 debug("Run GC outside of request's callback via setTimeout()");
51 setTimeout( function() {
52 evalAndLog("window.gc()");
58 function doThirdOpen()
62 evalAndLog("request = indexedDB.open(dbname, 2)");
63 evalAndLog("sawUpgradeNeeded3 = false");
64 request
.onerror
= unexpectedErrorCallback
;
65 request
.onblocked
= unexpectedBlockedCallback
;
66 request
.onupgradeneeded
= function onUpgradeNeeded2() {
68 evalAndLog("sawUpgradeNeeded3 = true");
70 request
.onsuccess
= function onOpenSuccess3() {
72 shouldBeTrue("sawUpgradeNeeded3");
73 evalAndLog("db = request.result");
74 evalAndLog("db.close()");