OLD | NEW |
1 Test IndexedDB's IDBObjectStore.clear(). | 1 Test IndexedDB's IDBObjectStore.clear(). |
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 = "objectstore-clear.html" | 6 dbname = "objectstore-clear.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 store = db.createObjectStore('storeName', null) | 9 store = db.createObjectStore('storeName', null) |
12 store.createIndex('indexName', '') | 10 store.createIndex('indexName', '') |
13 PASS store.indexNames.contains('indexName') is true | 11 PASS store.indexNames.contains('indexName') is true |
14 store.add('value', 'key') | 12 store.add('value', 'key') |
15 otherStore = db.createObjectStore('otherStoreName', null) | 13 otherStore = db.createObjectStore('otherStoreName', null) |
16 otherStore.add('value', 'key') | 14 otherStore.add('value', 'key') |
17 store.clear() | 15 store.clear() |
18 PASS event.target.result is undefined. | 16 PASS event.target.result is undefined. |
19 store.openCursor() | 17 store.openCursor() |
20 PASS event.target.result is null | 18 PASS event.target.result is null |
21 index = store.index('indexName') | 19 index = store.index('indexName') |
22 index.openKeyCursor() | 20 index.openKeyCursor() |
23 openKeyCursorSuccess(): | 21 openKeyCursorSuccess(): |
24 PASS event.target.result is null | 22 PASS event.target.result is null |
25 db.transaction(['otherStoreName']) | 23 db.transaction(['otherStoreName']) |
26 otherStore = transaction.objectStore('otherStoreName') | 24 otherStore = transaction.objectStore('otherStoreName') |
27 otherStore.get('key') | 25 otherStore.get('key') |
28 PASS event.target.result is "value" | 26 PASS event.target.result is "value" |
29 PASS successfullyParsed is true | 27 PASS successfullyParsed is true |
30 | 28 |
31 TEST COMPLETE | 29 TEST COMPLETE |
32 | 30 |
OLD | NEW |