| OLD | NEW |
| 1 Test IndexedDB Array-type keyPaths | 1 Test IndexedDB Array-type keyPaths |
| 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 = "keypath-arrays.html" | 8 dbname = "keypath-arrays.html" |
| 9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
| 10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
| 11 store = db.createObjectStore('store', {keyPath: ['a', 'b']}) | 11 store = db.createObjectStore('store', {keyPath: ['a', 'b']}) |
| 12 store.createIndex('index', ['c', 'd']) | 12 store.createIndex('index', ['c', 'd']) |
| 13 Expecting exception from db.createObjectStore('store-with-generator', {keyPath:
['a', 'b'], autoIncrement: true}) | 13 Expecting exception from db.createObjectStore('store-with-generator', {keyPath:
['a', 'b'], autoIncrement: true}) |
| 14 PASS Exception was thrown. | 14 PASS Exception was thrown. |
| 15 PASS code is DOMException.INVALID_ACCESS_ERR | 15 PASS code is DOMException.INVALID_ACCESS_ERR |
| 16 Exception message: The autoIncrement option was set but the keyPath option was e
mpty or an array. |
| 16 Expecting exception from store.createIndex('index-multientry', ['e', 'f'], {mult
iEntry: true}) | 17 Expecting exception from store.createIndex('index-multientry', ['e', 'f'], {mult
iEntry: true}) |
| 17 PASS Exception was thrown. | 18 PASS Exception was thrown. |
| 18 PASS code is DOMException.INVALID_ACCESS_ERR | 19 PASS code is DOMException.INVALID_ACCESS_ERR |
| 20 Exception message: The keyPath argument was an array and the multiEntry option i
s true. |
| 19 | 21 |
| 20 Empty arrays are not valid key paths: | 22 Empty arrays are not valid key paths: |
| 21 Expecting exception from db.createObjectStore('store-keypath-empty-array', {keyP
ath: []}) | 23 Expecting exception from db.createObjectStore('store-keypath-empty-array', {keyP
ath: []}) |
| 22 PASS Exception was thrown. | 24 PASS Exception was thrown. |
| 23 PASS code is DOMException.SYNTAX_ERR | 25 PASS code is DOMException.SYNTAX_ERR |
| 26 Exception message: The keyPath option is not a valid key path. |
| 24 Expecting exception from store.createIndex('index-keypath-empty-array', []) | 27 Expecting exception from store.createIndex('index-keypath-empty-array', []) |
| 25 PASS Exception was thrown. | 28 PASS Exception was thrown. |
| 26 PASS code is DOMException.SYNTAX_ERR | 29 PASS code is DOMException.SYNTAX_ERR |
| 30 Exception message: The keyPath argument contains an invalid key path. |
| 27 | 31 |
| 28 testKeyPaths(): | 32 testKeyPaths(): |
| 29 transaction = db.transaction(['store'], 'readwrite') | 33 transaction = db.transaction(['store'], 'readwrite') |
| 30 store = transaction.objectStore('store') | 34 store = transaction.objectStore('store') |
| 31 index = store.index('index') | 35 index = store.index('index') |
| 32 | 36 |
| 33 request = store.put({a: 1, b: 2, c: 3, d: 4}) | 37 request = store.put({a: 1, b: 2, c: 3, d: 4}) |
| 34 request = store.openCursor() | 38 request = store.openCursor() |
| 35 cursor = request.result | 39 cursor = request.result |
| 36 PASS cursor is non-null. | 40 PASS cursor is non-null. |
| 37 PASS JSON.stringify(cursor.key) is "[1,2]" | 41 PASS JSON.stringify(cursor.key) is "[1,2]" |
| 38 request = index.openCursor() | 42 request = index.openCursor() |
| 39 cursor = request.result | 43 cursor = request.result |
| 40 PASS cursor is non-null. | 44 PASS cursor is non-null. |
| 41 PASS JSON.stringify(cursor.primaryKey) is "[1,2]" | 45 PASS JSON.stringify(cursor.primaryKey) is "[1,2]" |
| 42 PASS JSON.stringify(cursor.key) is "[3,4]" | 46 PASS JSON.stringify(cursor.key) is "[3,4]" |
| 43 PASS successfullyParsed is true | 47 PASS successfullyParsed is true |
| 44 | 48 |
| 45 TEST COMPLETE | 49 TEST COMPLETE |
| 46 | 50 |
| OLD | NEW |