Closed Bug 638243 Opened 11 years ago Closed 11 years ago

Print function definition for eval in target scope (and fix warning for second argument to eval)

Categories

(Other Applications Graveyard :: Venkman JS Debugger, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: InvisibleSmiley, Unassigned)

Details

Attachments

(1 file)

Currently, if you enter some function name into the console, one of the following happens:
a) You're not currently debugging: The function definition is printed.
b) You're currently debugging: "[function] [class: Function]" is printed, followed by the function name, but not the definition.

I find that very annoying. If you're debugging, you often want to know what the definition of a function in the current scope is. Yes you can use .toSource() but that removes all line breaks which often makes it totally unreadable.

Attached you'll find a patch that special-cases functions in cmdEval (which is called if either you just enter something into the console or prepend it with /eval). While I was at it I removed some unused local variables and fixed the eval call in con_eval (eval only accepts one parameter now, cf. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/eval) which used to throw a warning.

Not assigning this to myself yet since I first need a hint whether this change is acceptable in general.
Attachment #516401 - Flags: review?(gijskruitbosch+bugs)
Comment on attachment 516401 [details] [diff] [review]
patch [Checkin: comment 2]

Trying someone else for review in Gijs's absence.
Attachment #516401 - Flags: review?(silver)
Attachment #516401 - Flags: review?(silver) → review?(timeless)
Attachment #516401 - Flags: review?(timeless) → review+
Comment on attachment 516401 [details] [diff] [review]
patch [Checkin: comment 2]

http://hg.mozilla.org/venkman/rev/3cf0c028cc0a
Attachment #516401 - Attachment description: patch → patch [Checkin: comment 2]
Attachment #516401 - Flags: review?(gijskruitbosch+bugs)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.