3 <script src=
"../../resources/js-test.js"></script>
4 <script src=
"resources/shared.js"></script>
9 description("Test that deleting an object store and a database containing blobs doesn't crash.");
11 indexedDBTest(prepareDatabase
, reopen
, {version
: 1});
12 function prepareDatabase()
14 db
= event
.target
.result
;
15 event
.target
.transaction
.onabort
= unexpectedAbortCallback
;
16 evalAndLog("store0 = db.createObjectStore('store0')");
17 evalAndLog("store1 = db.createObjectStore('store1')");
18 blobAContent
= "First blob content";
19 blobA
= new Blob([blobAContent
], {"type" : "text/plain"});
21 evalAndLog("store0.put(blobA, key)");
26 evalAndLog("db.close()");
28 evalAndLog("request = indexedDB.open(dbname, 2)");
29 request
.onupgradeneeded
= deleteObjectStore
;
30 request
.onsuccess
= unexpectedSuccessCallback
;
31 request
.onerror
= unexpectedErrorCallback
;
32 request
.onblocked
= unexpectedBlockedCallback
;
35 function deleteObjectStore(e
)
39 evalAndLog("db.deleteObjectStore('store0')");
40 request
.onsuccess
= didDeleteObjectStore
;
43 function didDeleteObjectStore()
46 blobBContent
= "Second blob content";
47 evalAndLog("trans = db.transaction('store1', 'readwrite')");
48 evalAndLog("store1 = trans.objectStore('store1')");
49 blobB
= new Blob([blobBContent
], {"type" : "text/plain"});
50 evalAndLog("store1.put(blobB, key)");
51 trans
.oncomplete
= deleteDatabase
;
52 trans
.onabort
= unexpectedAbortCallback
;
55 function deleteDatabase()
57 evalAndLog("db.close()");
58 evalAndLog("request = indexedDB.deleteDatabase(dbname)");
59 request
.onerror
= unexpectedErrorCallback
;
60 request
.onsuccess
= reportSuccess
;
63 function reportSuccess()
65 debug("Database deleted.");