OLD | NEW |
| 1 CONSOLE ERROR: line 1: ConstraintError: Unable to add key to index 'index1': at
least one key does not satisfy the uniqueness requirements. |
| 2 CONSOLE ERROR: line 1: ConstraintError: Unable to add key to index 'index2': at
least one key does not satisfy the uniqueness requirements. |
| 3 CONSOLE ERROR: line 1: ConstraintError: Unable to add key to index 'index4': at
least one key does not satisfy the uniqueness requirements. |
1 Verify edge cases that lazy index population in an IndexedDB implementation migh
t reveal. | 4 Verify edge cases that lazy index population in an IndexedDB implementation migh
t reveal. |
2 | 5 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 6 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 7 |
5 | 8 |
6 dbname = "lazy-index-population.html" | 9 dbname = "lazy-index-population.html" |
7 indexedDB.deleteDatabase(dbname) | 10 indexedDB.deleteDatabase(dbname) |
8 indexedDB.open(dbname) | 11 indexedDB.open(dbname) |
9 Deleted all object stores. | 12 Deleted all object stores. |
10 store = connection.createObjectStore('store') | 13 store = connection.createObjectStore('store') |
11 store.createIndex('index1', 'name', {unique: true}) | 14 store.createIndex('index1', 'name', {unique: true}) |
12 Verify that uniqueness constraints are enforced with a pre-existing index: | 15 Verify that uniqueness constraints are enforced with a pre-existing index: |
13 trans = connection.transaction('store', 'readwrite') | 16 trans = connection.transaction('store', 'readwrite') |
14 store = trans.objectStore('store') | 17 store = trans.objectStore('store') |
15 request1 = store.put({name: 'bob'}, 1) | 18 request1 = store.put({name: 'bob'}, 1) |
16 request2 = store.put({name: 'bob'}, 2) | 19 request2 = store.put({name: 'bob'}, 2) |
17 state = 0 | 20 state = 0 |
18 request1 received success event | 21 request1 received success event |
19 PASS ++state is 1 | 22 PASS ++state is 1 |
20 request2 received error event | 23 request2 received error event |
21 PASS ++state is 2 | 24 PASS ++state is 2 |
| 25 PASS Got expected error: 'ConstraintError: Unable to add key to index 'index1':
at least one key does not satisfy the uniqueness requirements.' |
| 26 PASS ++state is 3 |
22 transaction aborted | 27 transaction aborted |
23 PASS ++state is 3 | 28 PASS ++state is 4 |
24 PASS trans.error.name is 'ConstraintError' | 29 PASS trans.error.name is 'ConstraintError' |
25 | 30 |
26 Verify that uniqueness constraints are enforced when index is created before put
s: | 31 Verify that uniqueness constraints are enforced when index is created before put
s: |
27 connection.close() | 32 connection.close() |
28 indexedDB.open(dbname, 2) | 33 indexedDB.open(dbname, 2) |
29 deleteAllObjectStores(connection) | 34 deleteAllObjectStores(connection) |
30 Deleted all object stores. | 35 Deleted all object stores. |
31 store = connection.createObjectStore('store') | 36 store = connection.createObjectStore('store') |
32 store.createIndex('index2', 'name', {unique: true}) | 37 store.createIndex('index2', 'name', {unique: true}) |
33 request1 = store.put({name: 'carol'}, 1) | 38 request1 = store.put({name: 'carol'}, 1) |
34 request2 = store.put({name: 'carol'}, 2) | 39 request2 = store.put({name: 'carol'}, 2) |
35 state = 0 | 40 state = 0 |
36 request1 (index2) received success event | 41 request1 (index2) received success event |
37 PASS ++state is 1 | 42 PASS ++state is 1 |
38 request2 (index2) received error event | 43 request2 (index2) received error event |
39 PASS ++state is 2 | 44 PASS ++state is 2 |
| 45 PASS Got expected error: 'ConstraintError: Unable to add key to index 'index2':
at least one key does not satisfy the uniqueness requirements.' |
| 46 PASS ++state is 3 |
40 transaction aborted | 47 transaction aborted |
41 PASS ++state is 3 | 48 PASS ++state is 4 |
42 PASS trans.error.name is 'ConstraintError' | 49 PASS trans.error.name is 'ConstraintError' |
43 | 50 |
44 Verify that uniqueness constraints are enforced when index is created after puts
: | 51 Verify that uniqueness constraints are enforced when index is created after puts
: |
45 indexedDB.open(dbname, 3) | 52 indexedDB.open(dbname, 3) |
46 deleteAllObjectStores(connection) | 53 deleteAllObjectStores(connection) |
47 Deleted all object stores. | 54 Deleted all object stores. |
48 store = connection.createObjectStore('store') | 55 store = connection.createObjectStore('store') |
49 request1 = store.put({name: 'ted'}, 1) | 56 request1 = store.put({name: 'ted'}, 1) |
50 request2 = store.put({name: 'ted'}, 2) | 57 request2 = store.put({name: 'ted'}, 2) |
51 store.createIndex('index3', 'name', {unique: true}) | 58 store.createIndex('index3', 'name', {unique: true}) |
(...skipping 12 matching lines...) Expand all Loading... |
64 Deleted all object stores. | 71 Deleted all object stores. |
65 store = connection.createObjectStore('store') | 72 store = connection.createObjectStore('store') |
66 request1 = store.put({name: 'alice'}, 1) | 73 request1 = store.put({name: 'alice'}, 1) |
67 store.createIndex('index4', 'name', {unique: true}) | 74 store.createIndex('index4', 'name', {unique: true}) |
68 request2 = store.put({name: 'alice'}, 2) | 75 request2 = store.put({name: 'alice'}, 2) |
69 state = 0 | 76 state = 0 |
70 request1 received success event | 77 request1 received success event |
71 PASS ++state is 1 | 78 PASS ++state is 1 |
72 request2 received error event | 79 request2 received error event |
73 PASS ++state is 2 | 80 PASS ++state is 2 |
| 81 PASS Got expected error: 'ConstraintError: Unable to add key to index 'index4':
at least one key does not satisfy the uniqueness requirements.' |
| 82 PASS ++state is 3 |
74 transaction aborted | 83 transaction aborted |
75 PASS ++state is 3 | 84 PASS ++state is 4 |
76 PASS trans.error.name is 'ConstraintError' | 85 PASS trans.error.name is 'ConstraintError' |
77 PASS successfullyParsed is true | 86 PASS successfullyParsed is true |
78 | 87 |
79 TEST COMPLETE | 88 TEST COMPLETE |
80 | 89 |
OLD | NEW |