Index: test/mjsunit/stack-traces.js |
diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js |
index f80a627b24a87eae9fe00e5bd0a24c5b7f5af903..b256033b537233752dae87bdb71fadd153322a23 100644 |
--- a/test/mjsunit/stack-traces.js |
+++ b/test/mjsunit/stack-traces.js |
@@ -94,6 +94,37 @@ function testAnonymousMethod() { |
(function () { FAIL }).call([1, 2, 3]); |
} |
+function testFunctionName() { |
+ function gen(name, counter) { |
+ var f = function foo() { |
+ if (counter === 0) { |
+ FAIL; |
+ } |
+ gen(name, counter - 1)(); |
+ } |
+ if (counter === 4) { |
+ Object.defineProperty(f, 'name', {get: function(){ throw 239; }}); |
+ } else if (counter == 3) { |
+ Object.defineProperty(f, 'name', {value: 'boo' + '_' + counter}); |
+ } else { |
+ Object.defineProperty(f, 'name', {writable: true}); |
+ if (counter === 2) |
+ f.name = 42; |
+ else |
+ f.name = name + '_' + counter; |
+ } |
+ return f; |
+ } |
+ gen('foo', 4)(); |
+} |
+ |
+function testFunctionInferredName() { |
+ var f = function() { |
+ FAIL; |
+ } |
+ f(); |
+} |
+ |
function CustomError(message, stripPoint) { |
this.message = message; |
Error.captureStackTrace(this, stripPoint); |
@@ -261,6 +292,9 @@ testTrace("testValue", testValue, ["at Number.causeError"]); |
testTrace("testConstructor", testConstructor, ["new Plonk"]); |
testTrace("testRenamedMethod", testRenamedMethod, ["Wookie.a$b$c$d [as d]"]); |
testTrace("testAnonymousMethod", testAnonymousMethod, ["Array.<anonymous>"]); |
+testTrace("testFunctionName", testFunctionName, |
+ [" at foo_0 ", " at foo_1", " at foo ", " at boo_3 ", " at foo "]); |
+testTrace("testFunctionInferredName", testFunctionInferredName, [" at f "]); |
testTrace("testDefaultCustomError", testDefaultCustomError, |
["hep-hey", "new CustomError"], |
["collectStackTrace"]); |