Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: test/mjsunit/stack-traces.js

Issue 919653002: [V8] Use Function.name in Error.stack (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/messages.js ('K') | « src/messages.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/stack-traces.js
diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js
index f80a627b24a87eae9fe00e5bd0a24c5b7f5af903..ac4f2f127d574d6e678c0e839ac11b8baf824326 100644
--- a/test/mjsunit/stack-traces.js
+++ b/test/mjsunit/stack-traces.js
@@ -94,6 +94,19 @@ function testAnonymousMethod() {
(function () { FAIL }).call([1, 2, 3]);
}
+function testMethodDisplayName() {
+ function gen(name, counter) {
+ var f = function() {
+ if (counter === 0)
+ FAIL;
aandrey 2015/02/11 15:50:40 nit: use { } in v8 code
kozy 2015/02/11 16:11:56 Done.
+ gen(name, counter - 1)();
+ };
+ f.displayName = name + '_' + counter;
+ return f;
+ };
+ gen('foo', 2)();
+}
+
function CustomError(message, stripPoint) {
this.message = message;
Error.captureStackTrace(this, stripPoint);
@@ -261,6 +274,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("testMethodDisplayName", testMethodDisplayName,
+ [" at foo_0", " at foo_1", " at foo_2 "]);
testTrace("testDefaultCustomError", testDefaultCustomError,
["hep-hey", "new CustomError"],
["collectStackTrace"]);
« src/messages.js ('K') | « src/messages.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698