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..13a87f11f8f21cbc5e59563887663ab5f2414ab3 100644 |
| --- a/test/mjsunit/stack-traces.js |
| +++ b/test/mjsunit/stack-traces.js |
| @@ -94,6 +94,30 @@ 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 CustomError(message, stripPoint) { |
| this.message = message; |
| Error.captureStackTrace(this, stripPoint); |
| @@ -261,6 +285,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 boo_3 ", " at foo "]); |
|
Yang
2015/03/10 10:48:55
Do we test the inferred name code path? I thought
kozy
2015/03/10 15:26:08
Test added.
|
| testTrace("testDefaultCustomError", testDefaultCustomError, |
| ["hep-hey", "new CustomError"], |
| ["collectStackTrace"]); |