Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> | 4 <script> |
| 5 function promise_test(func, name, properties) { | 5 function promise_test(func, name, properties) { |
| 6 properties = properties || {}; | 6 properties = properties || {}; |
| 7 var test = async_test(name, properties); | 7 var test = async_test(name, properties); |
| 8 Promise.resolve(test.step(func, test, test)) | 8 Promise.resolve(test.step(func, test, test)) |
| 9 .then(function() { test.done(); }) | 9 .then(function() { test.done(); }) |
| 10 .catch(test.step_func(function(value) { throw value; })); | 10 .catch(test.step_func(function(value) { throw value; })); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 promise_test(function() { | 198 promise_test(function() { |
| 199 var set = new Set([function(){}]); | 199 var set = new Set([function(){}]); |
| 200 return structuredClone(set).then(function(clone) { | 200 return structuredClone(set).then(function(clone) { |
| 201 assert_unreached('Should have thrown an exception'); | 201 assert_unreached('Should have thrown an exception'); |
| 202 }).catch(function(ex) { | 202 }).catch(function(ex) { |
| 203 assert_true(ex instanceof DOMException, 'Should throw a DOMException'); | 203 assert_true(ex instanceof DOMException, 'Should throw a DOMException'); |
| 204 assert_equals(ex.code, DOMException.DATA_CLONE_ERR, 'Should be a DataClo neError'); | 204 assert_equals(ex.code, DOMException.DATA_CLONE_ERR, 'Should be a DataClo neError'); |
| 205 }); | 205 }); |
| 206 }, 'Cloning Sets should fail if they contain non-cloneable things'); | 206 }, 'Cloning Sets should fail if they contain non-cloneable things'); |
| 207 | 207 |
| 208 promise_test(function() { | |
| 209 return structuredClone(Symbol('foo')).then(function(clone) { | |
| 210 assert_unreached('Should have thrown an exception'); | |
| 211 }).catch(function(ex) { | |
|
jsbell
2015/08/19 01:24:11
I believe this will 'catch' the exception thrown b
adamk
2015/08/19 20:19:34
Fixed here and above to use the two-arg then().
| |
| 212 assert_true(ex instanceof DOMException, 'Should throw a DOMException'); | |
| 213 assert_equals(ex.code, DOMException.DATA_CLONE_ERR, 'Should be a DataClo neError'); | |
| 214 }); | |
| 215 }, 'Cloning Symbols should fail'); | |
| 216 | |
| 208 </script> | 217 </script> |
| OLD | NEW |