OLD | NEW |
1 Test IndexedDB's createObjectStore's various options | 1 Test IndexedDB's createObjectStore's various options |
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 = "create-object-store-options.html" | 6 dbname = "create-object-store-options.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 db.createObjectStore('a', {keyPath: 'a'}) | 9 db.createObjectStore('a', {keyPath: 'a'}) |
12 db.createObjectStore('b') | 10 db.createObjectStore('b') |
13 db.createObjectStore('c', {autoIncrement: true}); | 11 db.createObjectStore('c', {autoIncrement: true}); |
14 trans = db.transaction(['a', 'b'], 'readwrite') | 12 trans = db.transaction(['a', 'b'], 'readwrite') |
15 PASS trans.mode is "readwrite" | 13 PASS trans.mode is "readwrite" |
16 trans.objectStore('a').put({'a': 0}) | 14 trans.objectStore('a').put({'a': 0}) |
17 Expecting TypeError exception from db.createObjectStore('d', 'bar'); | 15 Expecting TypeError exception from db.createObjectStore('d', 'bar'); |
18 PASS Exception was thrown. | 16 PASS Exception was thrown. |
19 PASS db.createObjectStore('d', 'bar'); threw TypeError: Failed to execute 'creat
eObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object. | 17 PASS db.createObjectStore('d', 'bar'); threw TypeError: Failed to execute 'creat
eObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object. |
20 Expecting TypeError exception from db.createObjectStore('e', false); | 18 Expecting TypeError exception from db.createObjectStore('e', false); |
21 PASS Exception was thrown. | 19 PASS Exception was thrown. |
22 PASS db.createObjectStore('e', false); threw TypeError: Failed to execute 'creat
eObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object. | 20 PASS db.createObjectStore('e', false); threw TypeError: Failed to execute 'creat
eObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object. |
23 trans.objectStore('b').put({'a': 0}, 0) | 21 trans.objectStore('b').put({'a': 0}, 0) |
24 trans.objectStore('a').get(0) | 22 trans.objectStore('a').get(0) |
25 PASS event.target.result.a is {a: 0} | 23 PASS event.target.result.a is {a: 0} |
26 trans.objectStore('b').get(0) | 24 trans.objectStore('b').get(0) |
27 PASS event.target.result.a is {a: 0} | 25 PASS event.target.result.a is {a: 0} |
28 PASS successfullyParsed is true | 26 PASS successfullyParsed is true |
29 | 27 |
30 TEST COMPLETE | 28 TEST COMPLETE |
31 | 29 |
OLD | NEW |