| OLD | NEW |
| 1 Test IndexedDB keyPath edge cases | 1 Test IndexedDB keyPath edge cases |
| 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-edges.html" | 8 dbname = "keypath-edges.html" |
| 9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
| 10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
| 11 db.createObjectStore('store-with-path', {keyPath: 'foo'}) | 11 db.createObjectStore('store-with-path', {keyPath: 'foo'}) |
| 12 db.createObjectStore('store-with-path-and-generator', {keyPath: 'foo', autoIncre
ment: true}) | 12 db.createObjectStore('store-with-path-and-generator', {keyPath: 'foo', autoIncre
ment: true}) |
| 13 | 13 |
| 14 testKeyPaths(): | 14 testKeyPaths(): |
| 15 transaction = db.transaction(['store-with-path'], 'readwrite') | 15 transaction = db.transaction(['store-with-path'], 'readwrite') |
| 16 store = transaction.objectStore('store-with-path') | 16 store = transaction.objectStore('store-with-path') |
| 17 | 17 |
| 18 Key path doesn't resolve to a value; should yield null, should throw DATA_ERR | 18 Key path doesn't resolve to a value; should yield null, should throw DATA_ERR |
| 19 Expecting exception from store.put(null) | 19 Expecting exception from store.put(null) |
| 20 PASS Exception was thrown. | 20 PASS Exception was thrown. |
| 21 PASS code is 0 | 21 PASS code is 0 |
| 22 PASS ename is 'DataError' | 22 PASS ename is 'DataError' |
| 23 Exception message: Evaluating the object store's key path did not yield a value. | 23 Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the o
bject store's key path did not yield a value. |
| 24 | 24 |
| 25 Key path doesn't resolve to a value; should yield null, should throw DATA_ERR | 25 Key path doesn't resolve to a value; should yield null, should throw DATA_ERR |
| 26 Expecting exception from store.put({}) | 26 Expecting exception from store.put({}) |
| 27 PASS Exception was thrown. | 27 PASS Exception was thrown. |
| 28 PASS code is 0 | 28 PASS code is 0 |
| 29 PASS ename is 'DataError' | 29 PASS ename is 'DataError' |
| 30 Exception message: Evaluating the object store's key path did not yield a value. | 30 Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the o
bject store's key path did not yield a value. |
| 31 | 31 |
| 32 Key path resolves to a value that is invalid key; should yield 'invalid' key, sh
ould throw DATA_ERR | 32 Key path resolves to a value that is invalid key; should yield 'invalid' key, sh
ould throw DATA_ERR |
| 33 Expecting exception from store.put({foo: null}) | 33 Expecting exception from store.put({foo: null}) |
| 34 PASS Exception was thrown. | 34 PASS Exception was thrown. |
| 35 PASS code is 0 | 35 PASS code is 0 |
| 36 PASS ename is 'DataError' | 36 PASS ename is 'DataError' |
| 37 Exception message: Evaluating the object store's key path yielded a value that i
s not a valid key. | 37 Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the o
bject store's key path yielded a value that is not a valid key. |
| 38 | 38 |
| 39 Key path resolves to a value that is valid key; should yield 'string' key, shoul
d succeed | 39 Key path resolves to a value that is valid key; should yield 'string' key, shoul
d succeed |
| 40 store.put({foo: 'zoo'}) | 40 store.put({foo: 'zoo'}) |
| 41 PASS store.put succeeded | 41 PASS store.put succeeded |
| 42 | 42 |
| 43 testKeyPathsAndGenerator(): | 43 testKeyPathsAndGenerator(): |
| 44 transaction = db.transaction(['store-with-path-and-generator'], 'readwrite') | 44 transaction = db.transaction(['store-with-path-and-generator'], 'readwrite') |
| 45 store = transaction.objectStore('store-with-path-and-generator') | 45 store = transaction.objectStore('store-with-path-and-generator') |
| 46 | 46 |
| 47 Key path doesn't resolve to a value; should yield null but insertion would fail,
so put request should raise exception | 47 Key path doesn't resolve to a value; should yield null but insertion would fail,
so put request should raise exception |
| 48 Expecting exception from store.put(null) | 48 Expecting exception from store.put(null) |
| 49 PASS Exception was thrown. | 49 PASS Exception was thrown. |
| 50 PASS code is 0 | 50 PASS code is 0 |
| 51 PASS ename is 'DataError' | 51 PASS ename is 'DataError' |
| 52 Exception message: A generated key could not be inserted into the value. | 52 Exception message: Failed to execute 'put' on 'IDBObjectStore': A generated key
could not be inserted into the value. |
| 53 | 53 |
| 54 Key path doesn't resolve to a value; should yield null but insertion would fail,
so put request should raise exception | 54 Key path doesn't resolve to a value; should yield null but insertion would fail,
so put request should raise exception |
| 55 Expecting exception from store.put('string') | 55 Expecting exception from store.put('string') |
| 56 PASS Exception was thrown. | 56 PASS Exception was thrown. |
| 57 PASS code is 0 | 57 PASS code is 0 |
| 58 PASS ename is 'DataError' | 58 PASS ename is 'DataError' |
| 59 Exception message: A generated key could not be inserted into the value. | 59 Exception message: Failed to execute 'put' on 'IDBObjectStore': A generated key
could not be inserted into the value. |
| 60 | 60 |
| 61 Key path doesn't resolve to a value; should yield null, key should be generated,
put request should succeed | 61 Key path doesn't resolve to a value; should yield null, key should be generated,
put request should succeed |
| 62 store.put({}) | 62 store.put({}) |
| 63 PASS store.put succeeded | 63 PASS store.put succeeded |
| 64 | 64 |
| 65 Key path resolves to a value that is invalid key; should yield 'invalid' key, sh
ould throw DATA_ERR | 65 Key path resolves to a value that is invalid key; should yield 'invalid' key, sh
ould throw DATA_ERR |
| 66 Expecting exception from store.put({foo: null}) | 66 Expecting exception from store.put({foo: null}) |
| 67 PASS Exception was thrown. | 67 PASS Exception was thrown. |
| 68 PASS code is 0 | 68 PASS code is 0 |
| 69 PASS ename is 'DataError' | 69 PASS ename is 'DataError' |
| 70 Exception message: Evaluating the object store's key path yielded a value that i
s not a valid key. | 70 Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the o
bject store's key path yielded a value that is not a valid key. |
| 71 | 71 |
| 72 Key path resolves to a value that is valid key; should yield 'string' key, shoul
d succeed | 72 Key path resolves to a value that is valid key; should yield 'string' key, shoul
d succeed |
| 73 store.put({foo: 'zoo'}) | 73 store.put({foo: 'zoo'}) |
| 74 PASS store.put succeeded | 74 PASS store.put succeeded |
| 75 PASS successfullyParsed is true | 75 PASS successfullyParsed is true |
| 76 | 76 |
| 77 TEST COMPLETE | 77 TEST COMPLETE |
| 78 | 78 |
| OLD | NEW |