blob: cf03bcfda674db0cbb3cb116ff188bfb07a07136 [file] [log] [blame]
if (this.importScripts) {
importScripts('../../../resources/js-test.js');
importScripts('shared.js');
}
description("Test that deleteDatabase is blocked on open connections");
function test() {
removeVendorPrefixes();
setDBNameFromPath();
evalAndLog("blockedEventFired = false");
request = evalAndLog("indexedDB.open(dbname)");
request.onblocked = unexpectedBlockedCallback;
request.onerror = unexpectedErrorCallback;
request.onsuccess = function openOnSuccess(evt) {
preamble(evt);
evalAndLog("h = event.target.result");
h.onversionchange = function onVersionChange(evt) {
preamble(evt);
shouldBe("event.target.version", "1");
shouldBe("event.oldVersion", "1");
shouldBeNull("event.newVersion");
};
request = evalAndLog("indexedDB.deleteDatabase(dbname)");
request.onerror = unexpectedErrorCallback;
request.onblocked = function deleteDatabaseOnBlocked(evt) {
preamble(evt);
evalAndLog("blockedEventFired = true");
evalAndLog("h.close()");
};
request.onsuccess = function deleteDatabaseOnSuccess(evt) {
preamble(evt);
shouldBeTrue("blockedEventFired");
finishJSTest();
};
};
}
test();