1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("Ensure that IDBVersionChangeRequest objects are not GC'd if they have pending events");
10 evalAndLog("self.dbname = 'versionchangerequest-activedomobject'");
15 function testDeleteDatabase()
18 debug("testDeleteDatabase():");
19 // NOTE: deleteRequest is local variable so it is not captured in global scope.
20 var deleteRequest = evalAndLog("indexedDB.deleteDatabase(self.dbname)");
21 deleteRequest.onerror = unexpectedErrorCallback;
22 deleteRequest.onblocked = unexpectedBlockedCallback;
23 deleteRequest.onsuccess = function() { deleteSuccess(); };
26 evalAndLog("self.gc()");
30 function deleteSuccess()
32 testPassed("deleteDatabase's IDBVersionChangeRequest.onsuccess event fired");
36 function testSetVersion()
39 debug("testSetVersion():");
41 // NOTE: openRequest is local variable so it is not captured in global
43 var openRequest = evalAndLog("indexedDB.open(self.dbname)");
44 openRequest.onerror = unexpectedErrorCallback;
45 openRequest.onblocked = unexpectedBlockedCallback;
46 openRequest.onupgradeneeded = upgradeNeededCallback;
47 openRequest.onsuccess = successCallback;
50 evalAndLog("self.gc()");
54 function upgradeNeededCallback()
56 testPassed("IDBOpenDBRequest received upgradeneeded event");
59 function successCallback()
61 testPassed("IDBOpenDBRequest received success event");