| <p>This page tests whether an exception thrown from a function that has lazily |
| constructed an activation properly tears off the function's activation. |
| </p> |
| <p>If the test passes, you'll see a PASS message below. |
| </p> |
| <pre id="console"></pre> |
| |
| <script> |
| function log(s) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| } |
| |
| function shouldBe(aDescription, a, b) |
| { |
| if (a === b) { |
| log("PASS: " + aDescription + " should be " + b + " and is."); |
| } else { |
| log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + "."); |
| } |
| } |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| try { |
| // Lazily create an activation for a function that otherwise wouldn't need one, then throw. |
| (function f(x) { |
| throw f.arguments; |
| }(1)); |
| } catch(args) { |
| // Call another function to overwrite the stack. |
| (function (a, b, c, d, e, f, g, h, i, j, k, l) { })(); |
| |
| // Test whether args's activation was properly torn off. If it wasn't, the |
| // previous call should have clobbered its data. |
| shouldBe("args[0]", args[0], 1); |
| } |
| |
| </script> |