OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>IndexedDB: Error attributes are DOMExceptions</title> | |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <script src="resources/testharness-helpers.js"></script> | |
6 <script> | |
7 indexeddb_test( | |
8 function(t, db) { | |
9 db.createObjectStore('store'); | |
10 }, | |
11 function(t, db) { | |
12 var tx = db.transaction('store', 'readwrite'); | |
13 var store = tx.objectStore('store'); | |
14 var r1 = store.add('value', 'key'); | |
15 r1.onerror = t.unreached_func('first add should succeed'); | |
16 | |
17 var r2 = store.add('value', 'key'); | |
18 r2.onsuccess = t.unreached_func('second add should fail'); | |
19 | |
20 r2.onerror = t.step_func(function() { | |
21 assert_true(r2.error instanceof DOMException); | |
22 assert_equals(r2.error.name, 'ConstraintError'); | |
23 }); | |
24 | |
25 tx.oncomplete = t.unreached_func('transaction should not complete'); | |
26 tx.onabort = t.step_func(function() { | |
27 assert_true(tx.error instanceof DOMException); | |
28 assert_equals(tx.error.name, 'ConstraintError'); | |
29 t.done(); | |
30 }); | |
31 }, | |
32 'IDBRequest and IDBTransaction error properties should be DOMExceptions' | |
33 ); | |
34 </script> | |
OLD | NEW |