blob: 10698248ab1d8985f88ecd89fdfa4c8b0a55a5a5 [file] [log] [blame]
Test read-only transactions in IndexedDB.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('store')
store.put('x', 'y')
trans = db.transaction('store')
Expecting exception from trans.objectStore('store').put('a', 'b')
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to store record in an IDBObjectStore: The transaction is read-only.
trans = db.transaction('store')
Expecting exception from trans.objectStore('store').delete('x')
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transaction is read-only.
trans = db.transaction('store')
cur = trans.objectStore('store').openCursor()
PASS !event.target.result is false
Expecting exception from event.target.result.delete()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'delete' on 'IDBCursor': The record may not be deleted inside a read-only transaction.
PASS successfullyParsed is true
TEST COMPLETE