summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/throw.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/for-of/throw.js')
-rw-r--r--js/src/jit-test/tests/for-of/throw.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/for-of/throw.js b/js/src/jit-test/tests/for-of/throw.js
new file mode 100644
index 0000000000..2576ce1356
--- /dev/null
+++ b/js/src/jit-test/tests/for-of/throw.js
@@ -0,0 +1,20 @@
+// Control can exit a for-of loop via throw.
+
+function f() {
+ for (var a of [1, 2, 3]) {
+ for (var b of [1, 2, 3]) {
+ for (var c of [1, 2, 3]) {
+ if (a !== b && b !== c && c !== a)
+ throw [a, b, c];
+ }
+ }
+ }
+}
+
+var x = null;
+try {
+ f();
+} catch (exc) {
+ x = exc.join("");
+}
+assertEq(x, "123");