1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("Test read-only transactions in IndexedDB.");
8 indexedDBTest(prepareDatabase, setVersionDone);
9 function prepareDatabase()
11 db = event.target.result;
12 event.target.transaction.onabort = unexpectedAbortCallback;
13 store = evalAndLog("store = db.createObjectStore('store')");
14 evalAndLog("store.put('x', 'y')");
17 function setVersionDone()
19 trans = evalAndLog("trans = db.transaction('store')");
20 evalAndExpectException("trans.objectStore('store').put('a', 'b')", "0", "'ReadOnlyError'");
22 trans = evalAndLog("trans = db.transaction('store')");
23 evalAndExpectException("trans.objectStore('store').delete('x')", "0", "'ReadOnlyError'");
25 trans = evalAndLog("trans = db.transaction('store')");
26 cur = evalAndLog("cur = trans.objectStore('store').openCursor()");
27 cur.onsuccess = gotCursor;
28 cur.onerror = unexpectedErrorCallback;
33 shouldBeFalse("!event.target.result");
34 evalAndExpectException("event.target.result.delete()", "0", "'ReadOnlyError'");