Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / delete-closed-database-object.js
blob32a2291b4a8bf9d7d71d485aa1441792f3f0c40c
1 if (this.importScripts) {
2     importScripts('../../../resources/js-test.js');
3     importScripts('shared.js');
6 description("Ensure that IDBDatabase objects are deleted when there are no retaining paths left");
8 indexedDBTest(prepareDatabase, openSuccess);
9 function prepareDatabase()
13 function openSuccess()
15     db = event.target.result;
16     evalAndLog("db.close()");
18     var openRequest = evalAndLog("indexedDB.open(dbname)");
19     openRequest.onblocked = unexpectedBlockedCallback;
20     openRequest.onupgradeneeded = unexpectedUpgradeNeededCallback;
21     openRequest.onerror = unexpectedErrorCallback;
22     openRequest.onsuccess = function() {
23         debug("Dropping references to new connection.");
24         // After leaving this function, there are no remaining references to the
25         // db, so it should get deleted.
26         setTimeout(setVersion, 2);
27     };
30 function setVersion()
32     evalAndLog("gc()");
33     debug("Open request should not receive a blocked event:");
34     var request = evalAndLog("indexedDB.open(dbname, 2)");
35     request.onerror = unexpectedErrorCallback;
36     request.onblocked = unexpectedBlockedCallback;
37     request.onsuccess = finishJSTest;