OLD | NEW |
1 Test read-only transactions in IndexedDB. | 1 Test read-only transactions in IndexedDB. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; | |
7 | |
8 dbname = "transaction-read-only.html" | 6 dbname = "transaction-read-only.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 store = db.createObjectStore('store') | 9 store = db.createObjectStore('store') |
12 store.put('x', 'y') | 10 store.put('x', 'y') |
13 trans = db.transaction('store') | 11 trans = db.transaction('store') |
14 Expecting exception from trans.objectStore('store').put('a', 'b') | 12 Expecting exception from trans.objectStore('store').put('a', 'b') |
15 PASS Exception was thrown. | 13 PASS Exception was thrown. |
16 PASS code is 0 | 14 PASS code is 0 |
17 PASS ename is 'ReadOnlyError' | 15 PASS ename is 'ReadOnlyError' |
18 Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction
is read-only. | 16 Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction
is read-only. |
19 trans = db.transaction('store') | 17 trans = db.transaction('store') |
20 Expecting exception from trans.objectStore('store').delete('x') | 18 Expecting exception from trans.objectStore('store').delete('x') |
21 PASS Exception was thrown. | 19 PASS Exception was thrown. |
22 PASS code is 0 | 20 PASS code is 0 |
23 PASS ename is 'ReadOnlyError' | 21 PASS ename is 'ReadOnlyError' |
24 Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transacti
on is read-only. | 22 Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transacti
on is read-only. |
25 trans = db.transaction('store') | 23 trans = db.transaction('store') |
26 cur = trans.objectStore('store').openCursor() | 24 cur = trans.objectStore('store').openCursor() |
27 PASS !event.target.result is false | 25 PASS !event.target.result is false |
28 Expecting exception from event.target.result.delete() | 26 Expecting exception from event.target.result.delete() |
29 PASS Exception was thrown. | 27 PASS Exception was thrown. |
30 PASS code is 0 | 28 PASS code is 0 |
31 PASS ename is 'ReadOnlyError' | 29 PASS ename is 'ReadOnlyError' |
32 Exception message: Failed to execute 'delete' on 'IDBCursor': The record may not
be deleted inside a read-only transaction. | 30 Exception message: Failed to execute 'delete' on 'IDBCursor': The record may not
be deleted inside a read-only transaction. |
33 PASS successfullyParsed is true | 31 PASS successfullyParsed is true |
34 | 32 |
35 TEST COMPLETE | 33 TEST COMPLETE |
36 | 34 |
OLD | NEW |