diff options
Diffstat (limited to 'js/src/jit-test/tests/for-of/bug1773496.js')
-rw-r--r-- | js/src/jit-test/tests/for-of/bug1773496.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/for-of/bug1773496.js b/js/src/jit-test/tests/for-of/bug1773496.js new file mode 100644 index 0000000000..91ec0b4c8c --- /dev/null +++ b/js/src/jit-test/tests/for-of/bug1773496.js @@ -0,0 +1,47 @@ +var shouldBail = false; +function foo() { + if (shouldBail) { + bailout(); + return 0; + } + for (var i = 0; i < 1000; i++) {} + return { value: undefined, done: true } +} + +const iterable = { + [Symbol.iterator]() { + return { + i: 0, + next() { + return { value: this.i++, done: false } + }, + return() { + return foo(); + } + }; + } +} + +function closeIter() { + with ({}) {} + for (var x of iterable) { + if (x == 2) { + break; + } + } +} + +with ({}) {} +for (var i = 0; i < 100; i++) { + closeIter(); +} + +shouldBail = true; + +caught = false; +try { + closeIter(); +} catch { + caught = true; +} +assertEq(caught, true); |