Bug 101356 - Web Inspector: wrong output for empty object {}
Summary: Web Inspector: wrong output for empty object {}
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Pavel Feldman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-06 08:18 PST by Andrey Lushnikov
Modified: 2012-11-09 05:05 PST (History)
8 users (show)

See Also:


Attachments
Patch (16.81 KB, patch)
2012-11-07 08:28 PST, Pavel Feldman
vsevik: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Lushnikov 2012-11-06 08:18:24 PST
Step-by-step:
1. Open dev-tools -> console
2. input "({})" 
3. hit "enter"

Output:
Expandable Object

Expected:
Console prints "Object {}" - a short preview of the project in the way it does for other non-empty objects
Comment 1 Pavel Feldman 2012-11-07 08:28:36 PST
Created attachment 172813 [details]
Patch
Comment 2 Vsevolod Vlasov 2012-11-07 08:57:20 PST
Comment on attachment 172813 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=172813&action=review

> Source/WebCore/inspector/InjectedScriptSource.js:826
> +            this._generateProtoPreview(o, properties, elementsToDump);

Isn't properties redundant?

> Source/WebCore/inspector/InjectedScriptSource.js:834
> +    _generateProtoPreview: function(object, properties, elementsToDump)

properties === this.preview.properties, why is it needed?

> Source/WebCore/inspector/InjectedScriptSource.js:880
> +                    description  = this._abbreviateString(/** @type {string} */ (injectedScript._describe(value)), maxLength, subtype === "regexp");

extra space before =

> Source/WebCore/inspector/front-end/ConsoleMessage.js:333
> +                span.textContent = "function";

Please remove braces.
Or you could just replace else branches with
span.textContent = property.type === "function" ? "function" : property.value;
Comment 3 Pavel Feldman 2012-11-09 05:05:48 PST
Committed r134053: <http://trac.webkit.org/changeset/134053>