#10852 closed enhancement (wontfix)
Use displayName to help debugging dojo.declare in webkit
Reported by: | Adam Peller | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | Core | Version: | 1.4.0 |
Keywords: | Cc: | [email protected]…, alex | |
Blocked By: | Blocking: |
Description (last modified by )
From Patrick Mueller (IBM):
try adding the following line in safeMixin()
after the lines:
t.nom = name; target[name] = t;
The line to add:
if (typeof t == "function" && !t.displayName) t.displayName = name;
Here's something I just added to d.declare() that seemed to work; added it before the safeMixin() call; I ended up seeing things like "demo.Teacher::blink" in my call stack where before I just saw "(anonymous function)":
for (var propName in props) { if (props.hasOwnProperty(propName)) { var propVal = props[propName] if (typeof propVal == "function") { if (!propVal.displayName) { propVal.displayName = className + "::" + propName } } } }
Change History (7)
comment:1 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 12 years ago by
Cc: | alex added |
---|
comment:3 Changed 12 years ago by
Milestone: | tbd → 1.5 |
---|---|
Status: | new → assigned |
comment:4 Changed 12 years ago by
Component: | General → Core |
---|
comment:5 Changed 12 years ago by
Milestone: | 1.5 → 1.6 |
---|
comment:6 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
It looks like Webkit changed the way it shows method names, so the number of anonymous functions are greatly reduced. Closing this ticket for now.
comment:7 Changed 12 years ago by
I'm fine with closing the ticket, but thought I'd chime in.
It's not Webkit that changed, but V8. JSC, AFAIK, does not infer function names the way V8 does. So you will see more named functions in Chrome's DevTools? than you will in Safari Web Inspector, for instance.
The idea is good, but let's keep the base size small. I think we need to create a core module (dojo.debug?) to keep those helpers as addons. When e this module is included, it will decorate all dojo.declare-produced prototypes accordingly.
Rescheduling to 1.6 for now.