Bug 20695 - Inspector should display Array lengths in the property lists
Summary: Inspector should display Array lengths in the property lists
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: Jessie Berlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-07 01:22 PDT by Oliver Hunt
Modified: 2010-02-16 18:28 PST (History)
5 users (show)

See Also:


Attachments
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (1.16 KB, patch)
2010-02-14 10:53 PST, Jessie Berlin
no flags Details | Formatted Diff | Diff
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (and not in the console as well) (2.32 KB, patch)
2010-02-14 13:54 PST, Jessie Berlin
no flags Details | Formatted Diff | Diff
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (Fixed issues cited in comments) (2.33 KB, patch)
2010-02-14 18:50 PST, Jessie Berlin
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Hunt 2008-09-07 01:22:57 PDT
When looking at arrays in the scope pane their contents are sorted lexically rather than numerically.  Would also be helpful to have length info presented early.
Comment 1 Joseph Pecoraro 2009-09-14 13:33:35 PDT
The array sorting was fixed in:
https://bugs.webkit.org/show_bug.cgi?id=27329

However, listing the "length" doesn't currently happen.  Is this still wanted?
Comment 2 Timothy Hatcher 2009-09-14 13:44:01 PDT
I think we should show length, but not mixed with the number properties. But as a number next to the object name. We could/should do this for anythign with a length I think, so NodeLists, etc.

So it would look like this:

forBar: Array (2)
   0: "def"
   1: "abc"


Or:

myElement: HTMLDivElement
  childNodes: NodeList (2)
     0: HTMLDivElement
     1: HTMLDivElement
      ...
Comment 3 Brian Weinstein 2009-10-30 17:14:23 PDT
Do we show the name anymore? This would be straightforward, but with some tests I'm not sure the best place to put it:

> a
[5, 4, 3, 2, 3, 3, 3]

Should it look something like:

> a
Length: 5 [5, 4, 3, 2, 3, 3, 3]

or

> a
5 Items [5, 4, 3, 2, 3, 3, 3]

I'm just not sure the best way to put this in the UI, now that we don't explicitly state Array - however, we could do that.
Comment 4 Timothy Hatcher 2009-10-30 17:23:18 PDT
For property lists we still show the name (Array), or we should.

So my proposal would still stand: Array (2), etc.

You are thinking of logging. I don't think we need to show the lenght when logging an array like you did. Only if you do: dir(a) would we show what I mention and what this bug is about.
Comment 5 Jessie Berlin 2010-02-14 10:53:30 PST
Created attachment 48729 [details]
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists
Comment 6 Brian Weinstein 2010-02-14 11:03:52 PST
(In reply to comment #5)
> Created an attachment (id=48729) [details]
> Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the
> Inspector property lists

There arensome inspector layout tests that can test the console output (and output of console.dir). Does this break any tests/could this be tested?
Comment 7 Jessie Berlin 2010-02-14 12:09:27 PST
Comment on attachment 48729 [details]
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists

I need to make sure that the length doesn't get appended to the description in the console as well.
Comment 8 Timothy Hatcher 2010-02-14 13:27:00 PST
I think length in console would be useful.
Comment 9 Jessie Berlin 2010-02-14 13:54:02 PST
Created attachment 48731 [details]
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (and not in the console as well)
Comment 10 Jessie Berlin 2010-02-14 13:55:56 PST
(In reply to comment #8)
> I think length in console would be useful.

Same format as in the properties list?
Comment 11 Timothy Hatcher 2010-02-14 14:02:51 PST
I guess  we don't have a good place in the console to show it. Nevermind for now.
Comment 12 Timothy Hatcher 2010-02-14 14:07:49 PST
Comment on attachment 48731 [details]
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (and not in the console as well)

> diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog

> +    if (result.type == "array")

Use ===.


> +        if (this.property.value.propertyLength !== undefined)

Should be: typeof this.property.value.propertyLength !== "undefined"
Comment 13 Jessie Berlin 2010-02-14 18:50:32 PST
Created attachment 48738 [details]
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (Fixed issues cited in comments)
Comment 14 Jessie Berlin 2010-02-16 18:28:50 PST
Thanks for the review!

Committed in r54856: http://trac.webkit.org/changeset/54856