Chromium Code Reviews| Index: test/mjsunit/stack-traces.js |
| diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js |
| index f80a627b24a87eae9fe00e5bd0a24c5b7f5af903..243533e385b12a20bb6be7073e93ce0dbc2f252e 100644 |
| --- a/test/mjsunit/stack-traces.js |
| +++ b/test/mjsunit/stack-traces.js |
| @@ -94,6 +94,28 @@ 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 === 3) { |
| + Object.defineProperty(f, 'name', {get: function(){ throw 239; }}); |
| + } else { |
| + Object.defineProperty(f, 'name', {writable: true}); |
|
yurys
2015/03/06 11:11:26
Can you also test the case when value is passed as
kozy
2015/03/06 12:49:59
Done.
|
| + if (counter === 2) |
| + f.name = 42; |
| + else |
| + f.name = name + '_' + counter; |
| + } |
| + return f; |
| + } |
| + gen('foo', 3)(); |
| +} |
| + |
| function CustomError(message, stripPoint) { |
| this.message = message; |
| Error.captureStackTrace(this, stripPoint); |
| @@ -261,6 +283,8 @@ 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 foo "]); |
| testTrace("testDefaultCustomError", testDefaultCustomError, |
| ["hep-hey", "new CustomError"], |
| ["collectStackTrace"]); |