blob: b5b2cc2f9c507ad1b5fc138937b71ea0f2d24ac9 [file] [log] [blame]
Test IndexedDB's readonly transactions
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "readonly-transactions.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
objectStore = db.createObjectStore(osName, { autoIncrement: true });
Expecting exception from db.transaction([osName]).objectStore(osName).add({});
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction is read-only.
Expecting exception from db.transaction(osName).objectStore(osName).add({});
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction is read-only.
key1 = 1;
key2 = 2;
Expecting exception from db.transaction([osName]).objectStore(osName).put({}, key1);
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction is read-only.
Expecting exception from db.transaction(osName).objectStore(osName).put({}, key2);
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction is read-only.
Expecting exception from db.transaction([osName]).objectStore(osName).put({}, key1);
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction is read-only.
Expecting exception from db.transaction(osName).objectStore(osName).put({}, key1);
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction is read-only.
Expecting exception from db.transaction([osName]).objectStore(osName).delete(key1);
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.
Expecting exception from db.transaction(osName).objectStore(osName).delete(key2);
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.
PASS successfullyParsed is true
TEST COMPLETE