Bug 1001368 - Tests. (r=jimb)
authorShu-yu Guo <shu@rfrn.org>
Tue, 29 Apr 2014 21:57:36 -0700
changeset 180936 ef50feec881a82d7ad3a195734dba9f389088734
parent 180935 0112ac69a293df106443627dff31f8b367f5af03
child 180937 a0619a71579dac10fdfb2bcbcf8a1059f952f6ac
push id42895
push usershu@rfrn.org
push dateWed, 30 Apr 2014 04:57:45 +0000
treeherdermozilla-inbound@10e37b92e195 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1001368
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1001368 - Tests. (r=jimb)
js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-01.js
js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-02.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-01.js
@@ -0,0 +1,32 @@
+// Tests that exception handling works with block scopes.
+
+var g = newGlobal();
+var dbg = new Debugger(g);
+var correct;
+dbg.onEnterFrame = function (f) {
+  if (f.callee && f.callee.name == "f") {
+    f.onPop = function() {
+      // The scope at the point of onPop is the outermost.
+      correct = (f.environment.getVariable("e") === undefined &&
+                 f.environment.getVariable("outer") === 43);
+    };
+  }
+};
+g.eval("" + function f() {
+  var outer = 43;
+  try {
+    eval("");
+    throw 42;
+  } catch (e) {
+    noSuchFn(e);
+  }
+});
+
+
+try {
+  g.eval("f();");
+} catch (e) {
+  // The above is expected to throw.
+}
+
+assertEq(correct, true);
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-02.js
@@ -0,0 +1,35 @@
+// Tests that exception handling works with block scopes.
+
+var g = newGlobal();
+var dbg = new Debugger(g);
+var correct;
+dbg.onEnterFrame = function (f) {
+  if (f.callee && f.callee.name == "f") {
+    f.onPop = function() {
+      // The scope at the point of onPop is the outermost.
+      correct = (f.environment.getVariable("e") === undefined &&
+                 f.environment.getVariable("outer") === 43);
+    };
+  }
+};
+g.eval("" + function f() {
+  var outer = 43;
+  // Surround with a loop to insert a loop trynote.
+  for (;;) {
+    try {
+      eval("");
+      throw 42;
+    } catch (e) {
+      noSuchFn(e);
+    }
+  }
+});
+
+
+try {
+  g.eval("f();");
+} catch (e) {
+  // The above is expected to throw.
+}
+
+assertEq(correct, true);