Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#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: Patrick_Mueller@…, alex
Blocked By: Blocking:

Description (last modified by Adam Peller)

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 10 years ago by Adam Peller

Description: modified (diff)

comment:2 Changed 10 years ago by Adam Peller

Cc: alex added

comment:3 Changed 10 years ago by Eugene Lazutkin

Milestone: tbd1.5
Status: newassigned

comment:4 Changed 10 years ago by Eugene Lazutkin

Component: GeneralCore

comment:5 Changed 10 years ago by Eugene Lazutkin

Milestone: 1.51.6

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.

comment:6 Changed 9 years ago by Eugene Lazutkin

Resolution: wontfix
Status: assignedclosed

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 9 years ago by pmuellr

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.

Note: See TracTickets for help on using tickets.