Closed Bug 819049 Opened 13 years ago Closed 13 years ago

JS debugging protocol: provide function names in grips

Categories

(DevTools :: Debugger, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 20

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(4 files)

In the remote debugging protocol, "grips" are supposed to provide enough information to display a brief summary of the object, without further round trips. I'd like to expand the object grips for functions to include their names, whether explicit, inferred, or provided by the developer. Draft documentation is here: https://github.com/jimblandy/DebuggerDocs/compare/master...displayName Quick summary: function grips would look like this: { "type":"object", "class":"Function", "actor":<i>actor</i>, "name":<i>name</i>, "displayName":<i>displayName</i>, "userDisplayName":<i>userDisplayName</i> } We can then drop the 'calleeName' and 'functionName' properties from frame and environment forms, as those forms also include function grips; the *Name properties would be redundant. The nameAndParameters request can then become simply parameterNames.
Assignee: nobody → jimb
Status: NEW → ASSIGNED
Attachment #689348 - Flags: review?(past)
Those patches, applied in the order they were attached, implement the changes described by the github link in comment 0. Each is supposed to be a self-contained step towards the goal: Debugger xpcshell tests and mochitests should pass after each one individually. Try run with all four patches applied: https://tbpl.mozilla.org/?tree=Try&rev=031482e12675
Attachment #689348 - Flags: review?(past) → review+
Comment on attachment 689346 [details] [diff] [review] JS debugging protocol: provide 'name', 'displayName', and 'userDisplayName' properties on function grips. Review of attachment 689346 [details] [diff] [review]: ----------------------------------------------------------------- Just some nits. ::: toolkit/devtools/debugger/server/dbg-script-actors.js @@ +1515,5 @@ > + if (this.obj.class === "Function") { > + if (this.obj.name) > + g.name = this.obj.name; > + else if (this.obj.displayName) > + g.displayName = this.obj.displayName; Firefox JS code style requires curlies even for single-line blocks. ::: toolkit/devtools/debugger/tests/unit/test_functiongrips-01.js @@ +75,5 @@ > + > + do_check_eq(args[0].class, "Function"); > + // No name for an anonymous function, but it should have an inferred name. > + do_check_eq(args[0].name, undefined); > + do_check_eq(args[0].displayName, undefined); The comment suggests that displayName shouldn't be undefined, so I guess the comment is wrong.
Attachment #689346 - Flags: review?(past) → review+
Attachment #689350 - Flags: review?(past) → review+
Attachment #689351 - Flags: review?(past) → review+
(In reply to Panos Astithas [:past] from comment #6) > Firefox JS code style requires curlies even for single-line blocks. Fixed --- thanks! > The comment suggests that displayName shouldn't be undefined, so I guess the > comment is wrong. I fixed the comment.
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: