Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / bindings / test / test_callback_exceptions.html
blob93d47877744438086d238da406f181303465d699
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 */
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");
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>