Closed Bug 893491 Opened 12 years ago Closed 12 years ago

Statically name functions defined as this.func = function() { ... }

Categories

(Core :: JavaScript Engine, enhancement)

24 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: simon.lindholm10, Assigned: jimb)

Details

(Whiteboard: firebug-p1)

Attachments

(1 file)

From http://code.google.com/p/fbug/issues/detail?id=6574: function F() { this.g = function() { return new Error().stack; }; } new F().g() should give a nice, static name of this.g that contains the string "g". Currently it's empty.
Here is yet another test case (+instructions) that shows the problem. https://getfirebug.com/tests/manual/issues/6574/test.html Jim, any chance we could get this? Should I CC yet somebody else? Note that it's also a problem for built-in debugger. Honza
Whiteboard: firebug-p1
Does this patch help?
Assignee: general → jimb
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Any chance to get a try build? (Win 32 bit) Honza
I would add a test for function F() { this.g = function () {} } let f = new F() displayName(f.g)
(In reply to Tom Schuster [:evilpie] from comment #4) Okay; I added that, and it's in the try push.
(In reply to Jim Blandy :jimb from comment #5) > Try: https://tbpl.mozilla.org/?tree=Try&rev=b2a01df1b164 Yeah, works for me, thanks Jim! Honza
Interesting; browser/base/content/test/general/browser_tabopen_reflows.js matches function names appearing in Error stacks, so that will need to be updated. But nothing else!
Attachment #806073 - Flags: review?(terrence)
Flags: in-testsuite+
The try push looks good, so this just needs review.
Comment on attachment 806073 [details] [diff] [review] this-displayName.patch Review of attachment 806073 [details] [diff] [review]: ----------------------------------------------------------------- I'm not really the right reviewer for this, but as far as I can tell from looking at blame, there is no right reviewer for this. You have a working test and the code looks reasonable, however, so r=me.
Attachment #806073 - Flags: review?(terrence) → review+
I also looked at this and it seemed fine to me.
(In reply to Terrence Cole [:terrence] from comment #11) > I'm not really the right reviewer for this, but as far as I can tell from > looking at blame, there is no right reviewer for this. You have a working > test and the code looks reasonable, however, so r=me. Thanks for the review!
Target Milestone: --- → mozilla27
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: