blob: 32a2291b4a8bf9d7d71d485aa1441792f3f0c40c [file] [log] [blame]
if (this.importScripts) {
importScripts('../../../resources/js-test.js');
importScripts('shared.js');
}
description("Ensure that IDBDatabase objects are deleted when there are no retaining paths left");
indexedDBTest(prepareDatabase, openSuccess);
function prepareDatabase()
{
}
function openSuccess()
{
db = event.target.result;
evalAndLog("db.close()");
var openRequest = evalAndLog("indexedDB.open(dbname)");
openRequest.onblocked = unexpectedBlockedCallback;
openRequest.onupgradeneeded = unexpectedUpgradeNeededCallback;
openRequest.onerror = unexpectedErrorCallback;
openRequest.onsuccess = function() {
debug("Dropping references to new connection.");
// After leaving this function, there are no remaining references to the
// db, so it should get deleted.
setTimeout(setVersion, 2);
};
}
function setVersion()
{
evalAndLog("gc()");
debug("Open request should not receive a blocked event:");
var request = evalAndLog("indexedDB.open(dbname, 2)");
request.onerror = unexpectedErrorCallback;
request.onblocked = unexpectedBlockedCallback;
request.onsuccess = finishJSTest;
}