OLD | NEW |
1 Test IndexedDB's clearing an object store | 1 Test IndexedDB's clearing an object store |
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; | 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; |
7 | 7 |
8 dbname = "clear.html" | 8 dbname = "clear.html" |
9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
11 objectStore = db.createObjectStore('foo', { autoIncrement: true }); | 11 objectStore = db.createObjectStore('foo', { autoIncrement: true }); |
12 request = objectStore.add({}); | 12 request = objectStore.add({}); |
13 Expecting exception from db.transaction('foo').objectStore('foo').clear(); | 13 Expecting exception from db.transaction('foo').objectStore('foo').clear(); |
14 PASS Exception was thrown. | 14 PASS Exception was thrown. |
15 PASS code is 0 | 15 PASS code is 0 |
16 PASS ename is 'ReadOnlyError' | 16 PASS ename is 'ReadOnlyError' |
| 17 Exception message: A write operation was attempted in a read-only transaction. |
17 db.transaction('foo', 'readwrite') | 18 db.transaction('foo', 'readwrite') |
18 transaction.objectStore('foo').clear(); | 19 transaction.objectStore('foo').clear(); |
19 request = db.transaction('foo').objectStore('foo').openCursor(); | 20 request = db.transaction('foo').objectStore('foo').openCursor(); |
20 cursor = request.result; | 21 cursor = request.result; |
21 PASS cursor is null | 22 PASS cursor is null |
22 PASS successfullyParsed is true | 23 PASS successfullyParsed is true |
23 | 24 |
24 TEST COMPLETE | 25 TEST COMPLETE |
25 | 26 |
OLD | NEW |