| Index: test/mjsunit/stack-traces.js
|
| diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js
|
| index e457ece3c5527c8b0d3e0369b332e0062a4d8872..3bb5755aed77a0cbb2b903590917ce2645d4f49e 100644
|
| --- a/test/mjsunit/stack-traces.js
|
| +++ b/test/mjsunit/stack-traces.js
|
| @@ -84,9 +84,26 @@ function testAnonymousMethod() {
|
| (function () { FAIL }).call([1, 2, 3]);
|
| }
|
|
|
| +function CustomError(message, stripPoint) {
|
| + this.message = message;
|
| + Error.captureStackTrace(this, stripPoint);
|
| +}
|
| +
|
| +CustomError.prototype.toString = function () {
|
| + return "CustomError: " + this.message;
|
| +};
|
| +
|
| +function testDefaultCustomError() {
|
| + throw new CustomError("hep-hey", undefined);
|
| +}
|
| +
|
| +function testStrippedCustomError() {
|
| + throw new CustomError("hep-hey", CustomError);
|
| +}
|
| +
|
| // Utility function for testing that the expected strings occur
|
| // in the stack trace produced when running the given function.
|
| -function testTrace(fun, expected) {
|
| +function testTrace(fun, expected, unexpected) {
|
| var threw = false;
|
| try {
|
| fun();
|
| @@ -94,6 +111,11 @@ function testTrace(fun, expected) {
|
| for (var i = 0; i < expected.length; i++) {
|
| assertTrue(e.stack.indexOf(expected[i]) != -1);
|
| }
|
| + if (unexpected) {
|
| + for (var i = 0; i < unexpected.length; i++) {
|
| + assertEquals(e.stack.indexOf(unexpected[i]), -1);
|
| + }
|
| + }
|
| threw = true;
|
| }
|
| assertTrue(threw);
|
| @@ -165,6 +187,10 @@ testTrace(testValue, ["at Number.causeError"]);
|
| testTrace(testConstructor, ["new Plonk"]);
|
| testTrace(testRenamedMethod, ["Wookie.a$b$c$d [as d]"]);
|
| testTrace(testAnonymousMethod, ["Array.<anonymous>"]);
|
| +testTrace(testDefaultCustomError, ["hep-hey", "new CustomError"],
|
| + ["collectStackTrace"]);
|
| +testTrace(testStrippedCustomError, ["hep-hey"], ["new CustomError",
|
| + "collectStackTrace"]);
|
|
|
| testCallerCensorship();
|
| testUnintendedCallerCensorship();
|
|
|