Bug 17229

Summary: Inspector should show properties of all JS objects in Console
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: kkaefer, oliver, timothy
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 17242    
Attachments:
Description Flags
allows inspection of objects by just printing them to the console
none
shows some example inspected objects
none
changelog patch
none
updated patch which includes the changelog
none
patch with more information in changelog
none
do not print expandable objects in array literals
none
better patch which doesn't include the bogus select field
timothy: review-
updated patch with code style fixes timothy: review+

Description Adam Roben (:aroben) 2008-02-08 13:51:53 PST
The Inspector should show properties of all JS objects in the Console, and give you a way to inspect those properties.
Comment 1 Adam Roben (:aroben) 2008-02-08 14:17:34 PST
<rdar://problem/5732829>
Comment 2 Adam Roben (:aroben) 2008-02-11 13:44:06 PST
Perhaps we could add a panel/tab similar to Visual Studio's QuickWatch window that lets you dig down into the properties of one object.
Comment 3 Konstantin Käfer 2008-12-29 14:26:49 PST
Created attachment 26296 [details]
allows inspection of objects by just printing them to the console
Comment 4 Konstantin Käfer 2008-12-29 14:28:28 PST
Created attachment 26297 [details]
shows some example inspected objects
Comment 5 Konstantin Käfer 2008-12-29 14:44:14 PST
Created attachment 26301 [details]
changelog patch
Comment 6 Konstantin Käfer 2008-12-29 14:49:53 PST
Created attachment 26302 [details]
updated patch which includes the changelog
Comment 7 Konstantin Käfer 2008-12-29 15:03:56 PST
Created attachment 26303 [details]
patch with more information in changelog
Comment 8 Konstantin Käfer 2008-12-29 16:09:00 PST
Created attachment 26305 [details]
do not print expandable objects in array literals
Comment 9 Oliver Hunt 2008-12-30 02:29:52 PST
I like the look of the output of this, but i'm not sufficiently familiar with inspector to have any idea as to whether the code is the best it could be.  Carrying the inline parameter around seems inelegant to me.

I was going to CC tim and adam, but they should already be getting mail -- can one of you guys look at this?
Comment 10 Konstantin Käfer 2008-12-30 02:55:10 PST
Created attachment 26310 [details]
better patch which doesn't include the bogus select field
Comment 11 Timothy Hatcher 2008-12-30 06:57:05 PST
Comment on attachment 26310 [details]
better patch which doesn't include the bogus select field

Patch looks great! Some minor comments. r- for ow for some clean up.

> -                formattedResult.appendChild(formatForConsole(parameters[i]));
> +                formattedResult.appendChild(WebInspector.console._format(parameters[i]));

Why this change? The formatForConsole function just calls WebInspector.console._format.

> +        if (x instanceof Node) {
> +            while (this.titleElement.firstChild) {
> +                this.titleElement.removeChild(this.titleElement.firstChild);
> +            }

You should use this.titleElement.removeChildren() instead of the while loop (a prototype extension we have in utilities.js.)

> +        }
> +        else {

The "else {" should be on the previous line, so it is "} else {".

> +.console-formatted-object .section, .console-formatted-node .section {
> +  position: static;
> +}
> +

There should be 4 spaces here for the indent, not 2.
Comment 12 Konstantin Käfer 2008-12-31 06:56:30 PST
Created attachment 26335 [details]
updated patch with code style fixes

> > -                formattedResult.appendChild(formatForConsole(parameters[i]));
> > +                formattedResult.appendChild(WebInspector.console._format(parameters[i]));
> 
> Why this change? The formatForConsole function just calls
> WebInspector.console._format.

formatForConsole() passes the parameter true for inline, but that is not what we want in all cases. The attached patch fixes that and does treat "console.log(window, document)" as inline again (thus they won't be expnadable). Doing a "console.log(document)" (i.e. with only one element) will now trigger the expandable mode.
Comment 13 Timothy Hatcher 2008-12-31 11:55:13 PST
Comment on attachment 26335 [details]
updated patch with code style fixes

Nice work! Thanks for the patch!
Comment 14 Oliver Hunt 2009-01-01 17:08:35 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/inspector/front-end/Console.js
	M	WebCore/inspector/front-end/PropertiesSection.js
	M	WebCore/inspector/front-end/inspector.css
Committed r39537