test_callback_exceptions.html (859B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test for ...</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id="log"></div> 7 <script> 8 /* global promise_test, promise_rejects */ 9 10 promise_test(function(t) { 11 var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, JSON.parse); 12 return promise_rejects(t, new SyntaxError, 13 Promise.resolve().then(iterator.nextNode.bind(iterator))); 14 }, "Trying to use JSON.parse as filter should throw a catchable SyntaxError exception even when the filter is invoked async"); 15 16 promise_test(function(t) { 17 return promise_rejects(t, new SyntaxError, Promise.resolve("{").then(JSON.parse)); 18 }, "Trying to use JSON.parse as a promise callback should allow the next promise to handle the resulting exception."); 19 </script>