1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("Test that an aborted 'versionchange' transaction closes the connection.");
8 indexedDBTest(prepareDatabase, onOpen, {version: 1});
9 function prepareDatabase(evt)
12 evalAndLog("db = event.target.result");
13 evalAndLog("db.createObjectStore('store')");
19 evalAndLog("db = event.target.result");
20 evalAndLog("db.close()");
24 function openAgain() {
26 evalAndLog("request = indexedDB.open(dbname, 2)");
27 request.onsuccess = unexpectedSuccessCallback;
28 request.onblocked = unexpectedBlockedCallback;
29 request.onupgradeneeded = onUpgradeNeeded;
30 request.onerror = onOpenError;
33 function onUpgradeNeeded(evt)
36 evalAndLog("db = event.target.result");
37 evalAndLog("transaction = event.target.transaction");
38 evalAndLog("sawTransactionAbort = false");
39 transaction.oncomplete = unexpectedCompleteCallback;
40 transaction.onabort = onTransactionAbort;
44 function onTransactionAbort(evt)
47 evalAndLog("sawTransactionAbort = true");
48 debug("creating a transaction should fail because connection is closed:");
49 evalAndExpectException("db.transaction('store')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
52 function onOpenError(evt)
55 shouldBeTrue("sawTransactionAbort");
56 debug("creating a transaction should fail because connection is closed:");
57 evalAndExpectException("db.transaction('store')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");