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; | |
7 | |
8 dbname = "clear.html" | 6 dbname = "clear.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 objectStore = db.createObjectStore('foo', { autoIncrement: true }); | 9 objectStore = db.createObjectStore('foo', { autoIncrement: true }); |
12 request = objectStore.add({}); | 10 request = objectStore.add({}); |
13 Expecting exception from db.transaction('foo').objectStore('foo').clear(); | 11 Expecting exception from db.transaction('foo').objectStore('foo').clear(); |
14 PASS Exception was thrown. | 12 PASS Exception was thrown. |
15 PASS code is 0 | 13 PASS code is 0 |
16 PASS ename is 'ReadOnlyError' | 14 PASS ename is 'ReadOnlyError' |
17 Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transactio
n is read-only. | 15 Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transactio
n is read-only. |
18 db.transaction('foo', 'readwrite') | 16 db.transaction('foo', 'readwrite') |
19 transaction.objectStore('foo').clear(); | 17 transaction.objectStore('foo').clear(); |
20 request = db.transaction('foo').objectStore('foo').openCursor(); | 18 request = db.transaction('foo').objectStore('foo').openCursor(); |
21 cursor = request.result; | 19 cursor = request.result; |
22 PASS cursor is null | 20 PASS cursor is null |
23 PASS successfullyParsed is true | 21 PASS successfullyParsed is true |
24 | 22 |
25 TEST COMPLETE | 23 TEST COMPLETE |
26 | 24 |
OLD | NEW |