()
| 76 | |
| 77 | // Exception in 'return' vs Exception in callback |
| 78 | function testExceptionPriority() { |
| 79 | let iterable = { |
| 80 | [Symbol.iterator]() { |
| 81 | return { |
| 82 | next() { return { value: 1, done: false }; }, |
| 83 | return() { |
| 84 | throw new Error("Exception in return"); |
| 85 | } |
| 86 | }; |
| 87 | } |
| 88 | }; |
| 89 | |
| 90 | try { |
| 91 | %IterableForEach(iterable, (x) => { |
| 92 | throw new Error("Exception in callback"); |
| 93 | }); |
| 94 | } catch (e) { |
| 95 | // The spec says if completion is a throw completion, return ? completion. |
| 96 | // So "Exception in callback" should be rethrown, suppressing "Exception in return". |
| 97 | assertEquals("Exception in callback", e.message); |
| 98 | } |
| 99 | } |
| 100 | testExceptionPriority(); |
| 101 | |
| 102 | // Stack overflow |
no test coverage detected