Bug 17229 - Inspector should show properties of all JS objects in Console
Summary: Inspector should show properties of all JS objects in Console
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 17242
  Show dependency treegraph
 
Reported: 2008-02-08 13:51 PST by Adam Roben (:aroben)
Modified: 2009-01-01 17:08 PST (History)
3 users (show)

See Also:


Attachments
allows inspection of objects by just printing them to the console (5.08 KB, patch)
2008-12-29 14:26 PST, Konstantin Käfer
no flags Details | Formatted Diff | Diff
shows some example inspected objects (64.14 KB, image/png)
2008-12-29 14:28 PST, Konstantin Käfer
no flags Details
changelog patch (868 bytes, text/plain)
2008-12-29 14:44 PST, Konstantin Käfer
no flags Details
updated patch which includes the changelog (5.93 KB, patch)
2008-12-29 14:49 PST, Konstantin Käfer
no flags Details | Formatted Diff | Diff
patch with more information in changelog (6.73 KB, patch)
2008-12-29 15:03 PST, Konstantin Käfer
no flags Details | Formatted Diff | Diff
do not print expandable objects in array literals (7.85 KB, patch)
2008-12-29 16:09 PST, Konstantin Käfer
no flags Details | Formatted Diff | Diff
better patch which doesn't include the bogus select field (6.91 KB, patch)
2008-12-30 02:55 PST, Konstantin Käfer
timothy: review-
Details | Formatted Diff | Diff
updated patch with code style fixes (6.82 KB, patch)
2008-12-31 06:56 PST, Konstantin Käfer
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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