Closed Bug 1748164 Opened 4 years ago Closed 4 years ago

restore the non-standard displayName feature

Categories

(DevTools :: Debugger, enhancement)

Firefox 95
enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1755284

People

(Reporter: jaborandi, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

the non-standard displayName feature is the only effective way to get a usable stack trace for object-oriented code

the only one that works universally - regardless of how the specific framework implements classes, and - right now - the only one that would work at all, since even for native classess methods stack trace shows no class names (bug #1748135), regardless of whether you use ES6 syntax or prototypes

However this feature seems to have been removed
I don't know in which version, but, although MDN lists it as supported by FF, at least in versions 82 and 95 the following code

var a = function() { console.trace(); }; a.displayName = 'b'; a();

yelds

console.trace() ...
a ...
<anonymous> ...

not

console.trace() ...
b ...
<anonymous> ...

stack trace of an OOP code without class names is not unlike a street address without city and country for international shipping - it is half-useless

and even when #1748135 is revolsed it'd be an unreasonable to expect everyone to abandone frameworks and migrate to using native classes / constructs only

please restore the displayName support

Summary: restore the non-standard displaName feature → restore the non-standard displayName feature

Hello!

Thank you for reporting this issue, I will mark this issue as NEW and setting a component for this issue in order for our developers to look more into it and take into consideration on further releases! If it's not the right component please feel free to change it to an appropriate one.

Best regards,
Sergiu

Status: UNCONFIRMED → NEW
Component: Untriaged → Debugger
Ever confirmed: true
Product: Firefox → DevTools

there's a Function object's name property
which is read-only, but configurable
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name

In Chrome, this property's value is used in all stack traces.
In Firefox, however, it

So, I figure it's more appropriate to create a bug, requesting to use name property in stack trace, instead of restoring non-standard property.
Changing this one to Resolved

*In FF, however, it is not

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → MOVED

(In reply to support from comment #2)

So, I figure it's more appropriate to create a bug, requesting to use name property in stack trace, instead of restoring non-standard property.
Changing this one to Resolved

Is the new bug filed somewhere?

Honza

Resolution: MOVED → DUPLICATE

@Jan Honza Odvarko - yes, sorry, just added that

You need to log in before you can comment on or make changes to this bug.