1 Exercise optional arguments with missing vs. undefined in IndexedDB methods.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 dbname = "optional-arguments.html"
7 indexedDB.deleteDatabase(dbname)
11 db = event.target.result
12 store = db.createObjectStore('store', {keyPath: 'id'})
13 store.createIndex('by_name', 'name', {unique: true})
14 store.put({id: 1, name: 'a'})
15 tx = db.transaction('store', 'readwrite')
16 store = tx.objectStore('store')
17 index = store.index('by_name')
18 PASS IDBKeyRange.lowerBound(0).lowerOpen is false
19 PASS IDBKeyRange.upperBound(0).upperOpen is false
20 PASS IDBKeyRange.bound(0, 1).lowerOpen is false
21 PASS IDBKeyRange.bound(0, 1).upperOpen is false
22 PASS IDBKeyRange.lowerBound(0, undefined).lowerOpen is false
23 PASS IDBKeyRange.upperBound(0, undefined).upperOpen is false
24 PASS IDBKeyRange.bound(0, 1, undefined, undefined).lowerOpen is false
25 PASS IDBKeyRange.bound(0, 1, undefined, undefined).upperOpen is false
26 PASS store.add({id: 2, name: 'b'}) did not throw exception.
27 PASS store.put({id: 3, name: 'c'}) did not throw exception.
28 PASS store.add({id: 4, name: 'd'}, undefined) did not throw exception.
29 PASS store.put({id: 5, name: 'e'}, undefined) did not throw exception.
32 request = store.openCursor()
33 cursor = request.result
34 PASS cursor.direction is "next"
38 request = store.openCursor(null)
39 cursor = request.result
40 PASS cursor.direction is "next"
44 request = store.openCursor(IDBKeyRange.lowerBound(4))
45 cursor = request.result
46 PASS cursor.direction is "next"
50 request = store.openCursor(3)
51 cursor = request.result
52 PASS cursor.direction is "next"
56 request = store.openKeyCursor()
57 cursor = request.result
58 PASS cursor.direction is "next"
62 request = store.openKeyCursor(null)
63 cursor = request.result
64 PASS cursor.direction is "next"
68 request = store.openKeyCursor(IDBKeyRange.lowerBound(4))
69 cursor = request.result
70 PASS cursor.direction is "next"
74 request = store.openKeyCursor(3)
75 cursor = request.result
76 PASS cursor.direction is "next"
80 request = index.openCursor()
81 cursor = request.result
82 PASS cursor.direction is "next"
86 request = index.openCursor(null)
87 cursor = request.result
88 PASS cursor.direction is "next"
92 request = index.openCursor(IDBKeyRange.lowerBound('b'))
93 cursor = request.result
94 PASS cursor.direction is "next"
98 request = index.openCursor('c')
99 cursor = request.result
100 PASS cursor.direction is "next"
104 request = index.openKeyCursor()
105 cursor = request.result
106 PASS cursor.direction is "next"
110 request = index.openKeyCursor(null)
111 cursor = request.result
112 PASS cursor.direction is "next"
116 request = index.openKeyCursor(IDBKeyRange.lowerBound('b'))
117 cursor = request.result
118 PASS cursor.direction is "next"
122 request = index.openKeyCursor('c')
123 cursor = request.result
124 PASS cursor.direction is "next"
128 request = store.count()
129 PASS request.result is 5
132 request = store.count(null)
133 PASS request.result is 5
136 request = store.count(IDBKeyRange.lowerBound(2))
137 PASS request.result is 4
140 request = index.count()
141 PASS request.result is 5
144 request = index.count(null)
145 PASS request.result is 5
148 request = index.count(IDBKeyRange.lowerBound('b'))
149 PASS request.result is 4
152 request = store.openCursor()
153 cursor = request.result
154 PASS request.result is non-null.
155 PASS cursor.continue(undefined) did not throw exception.
156 PASS successfullyParsed is true