diff options
Diffstat (limited to 'js/src/jit-test/tests/for-of/throw-during-break.js')
-rw-r--r-- | js/src/jit-test/tests/for-of/throw-during-break.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/for-of/throw-during-break.js b/js/src/jit-test/tests/for-of/throw-during-break.js new file mode 100644 index 0000000000..352f6017df --- /dev/null +++ b/js/src/jit-test/tests/for-of/throw-during-break.js @@ -0,0 +1,42 @@ +var whoCaught = "nobody" + +function* wrapNoThrow() { + let iter = { + [Symbol.iterator]() { + return this; + }, + next() { + return { value: 10, done: false }; + }, + return() { throw "nonsense"; } + }; + for (const i of iter) + yield i; + } +function foo() { + try { + l2: + for (j of wrapNoThrow()) { + try { + for (i of [1,2,3]) { + try { + break l2; + } catch(e) { + whoCaught = "inner" + } + } + } catch (e) { + whoCaught = "inner2" + } + } + } catch (e) { + whoCaught = "correct" + } +} + +try { + foo(); +} catch (e) { whoCaught = "outer" } + + +assertEq(whoCaught, "correct"); |