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