IndexedDB: don't expose IDBDatabaseError to script
[WebKit-https.git] / LayoutTests / storage / indexeddb / keypath-edges-expected.txt
1 Test IndexedDB keyPath edge cases
2
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
7
8 indexedDB.deleteDatabase('keypath-edges')
9 indexedDB.open('keypath-edges')
10
11 openSuccess():
12 db = event.target.result
13 request = db.setVersion('1')
14 db.createObjectStore('store-with-path', {keyPath: 'foo'})
15 db.createObjectStore('store-with-path-and-generator', {keyPath: 'foo', autoIncrement: true})
16
17 testKeyPaths():
18 transaction = db.transaction(['store-with-path'], IDBTransaction.READ_WRITE)
19 store = transaction.objectStore('store-with-path')
20
21 Key path doesn't resolve to a value; should yield null, should throw DATA_ERR
22 Expecting exception from store.put(null)
23 PASS Exception was thrown.
24 PASS code is IDBDatabaseException.DATA_ERR
25
26 Key path doesn't resolve to a value; should yield null, should throw DATA_ERR
27 Expecting exception from store.put({})
28 PASS Exception was thrown.
29 PASS code is IDBDatabaseException.DATA_ERR
30
31 Key path resolves to a value that is invalid key; should yield 'invalid' key, should throw DATA_ERR
32 Expecting exception from store.put({foo: null})
33 PASS Exception was thrown.
34 PASS code is IDBDatabaseException.DATA_ERR
35
36 Key path resolves to a value that is valid key; should yield 'string' key, should succeed
37 store.put({foo: 'zoo'})
38 PASS store.put succeeded
39
40 testKeyPathsAndGenerator():
41 transaction = db.transaction(['store-with-path-and-generator'], IDBTransaction.READ_WRITE)
42 store = transaction.objectStore('store-with-path-and-generator')
43
44 Key path doesn't resolve to a value; should yield null but insertion would fail, so put request should raise exception
45 Expecting exception from store.put(null)
46 PASS Exception was thrown.
47 PASS code is IDBDatabaseException.DATA_ERR
48
49 Key path doesn't resolve to a value; should yield null but insertion would fail, so put request should raise exception
50 Expecting exception from store.put('string')
51 PASS Exception was thrown.
52 PASS code is IDBDatabaseException.DATA_ERR
53
54 Key path doesn't resolve to a value; should yield null, key should be generated, put request should succeed
55 store.put({})
56 PASS store.put succeeded
57
58 Key path resolves to a value that is invalid key; should yield 'invalid' key, should throw DATA_ERR
59 Expecting exception from store.put({foo: null})
60 PASS Exception was thrown.
61 PASS code is IDBDatabaseException.DATA_ERR
62
63 Key path resolves to a value that is valid key; should yield 'string' key, should succeed
64 store.put({foo: 'zoo'})
65 PASS store.put succeeded
66 PASS successfullyParsed is true
67
68 TEST COMPLETE
69