summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/try-finally-3.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/warp/try-finally-3.js')
-rw-r--r--js/src/jit-test/tests/warp/try-finally-3.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/warp/try-finally-3.js b/js/src/jit-test/tests/warp/try-finally-3.js
new file mode 100644
index 0000000000..98811486db
--- /dev/null
+++ b/js/src/jit-test/tests/warp/try-finally-3.js
@@ -0,0 +1,35 @@
+var target = undefined;
+function throwOn(x) {
+ with ({}) {}
+ if (x === target) {
+ throw x;
+ }
+}
+
+// Test nested try-finally
+function foo() {
+ let result = 0;
+ try {
+ throwOn(1);
+ result += 1;
+ try {
+ throwOn(2);
+ result += 2;
+ } finally {
+ result += 3;
+ }
+ } finally {
+ return result;
+ }
+}
+
+with ({}) {}
+for (var i = 0; i < 100; i++) {
+ assertEq(foo(), 6);
+}
+
+target = 1;
+assertEq(foo(), 0);
+
+target = 2;
+assertEq(foo(), 4);