OLD | NEW |
---|---|
1 var databaseName = "database"; | 1 var databaseName = "database"; |
2 var databaseVersion = 1; | 2 var databaseVersion = 1; |
3 | 3 |
4 /* Delete created databases | 4 /* Delete created databases |
5 * | 5 * |
6 * Go through each finished test, see if it has an associated database. Close | 6 * Go through each finished test, see if it has an associated database. Close |
7 * that and delete the database. */ | 7 * that and delete the database. */ |
8 add_completion_callback(function(tests) | 8 add_completion_callback(function(tests) |
9 { | 9 { |
10 for (var i in tests) | 10 for (var i in tests) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 function expect(t, expected) { | 136 function expect(t, expected) { |
137 var results = []; | 137 var results = []; |
138 return result => { | 138 return result => { |
139 results.push(result); | 139 results.push(result); |
140 if (results.length === expected.length) { | 140 if (results.length === expected.length) { |
141 assert_array_equals(results, expected); | 141 assert_array_equals(results, expected); |
142 t.done(); | 142 t.done(); |
143 } | 143 } |
144 }; | 144 }; |
145 } | 145 } |
146 | |
147 // Checks to see if the passed transaction is active (by | |
148 // making | |
149 // requests against the named store). Returns a function to | |
150 // to let the transaction finish. | |
pwnall
2017/03/04 00:27:33
double "to", and I don't think this comment is acc
jsbell
2017/03/06 18:25:02
Thanks. And whoah, not sure what happened there.
| |
151 function is_transaction_active(tx, store_name) { | |
152 try { | |
153 const request = tx.objectStore(store_name).get(0); | |
154 request.onerror = e => { | |
155 e.preventDefault(); | |
156 e.stopPropagation(); | |
157 }; | |
158 return true; | |
159 } catch (ex) { | |
160 assert_equals(ex.name, 'TransactionInactiveError', | |
161 'Active check should either not throw, or throw ' + | |
pwnall
2017/03/04 00:27:33
"not throw anything" would make the structure para
jsbell
2017/03/06 18:25:02
Done.
| |
162 'TransactionInactiveError'); | |
163 return false; | |
164 } | |
165 } | |
OLD | NEW |