Bug 141058 - Web Inspector: Support console.table
Summary: Web Inspector: Support console.table
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-01-29 16:08 PST by Joseph Pecoraro
Modified: 2015-02-02 13:09 PST (History)
10 users (show)

See Also:


Attachments
[IMAGE] Progress (116.83 KB, image/png)
2015-01-29 16:24 PST, Joseph Pecoraro
no flags Details
[PATCH] Proposed Fix (22.23 KB, patch)
2015-01-29 16:40 PST, Joseph Pecoraro
timothy: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-mavericks (661.44 KB, application/zip)
2015-01-29 17:11 PST, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-mavericks-wk2 (1.16 MB, application/zip)
2015-01-29 17:27 PST, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-01-29 16:08:19 PST
* SUMMARY
Support console.table:
https://developer.mozilla.org/en-US/docs/Web/API/Console.table

* SUGGESTED OUTPUT
- Support a single array:
  - console.table(["a", "b", "c"])
  => 2 columns, "Index" and "Value"
- Support a single object: 
  - console.table({first:"Joe",last:"Peck"})
  => 2 columns, "Index" which will be object keys and "Value" the value for that key
- Support array of arrays: console.table([["Joe", "Peck"], ["First", "Last"]])
  => 3 columns, "(Index)" for the item index in the outer list, "0", "1" indexes of the arrays in the inner lists
- Support array of objects: console.table({first:"Joe",last:"Peck"}, {first:"First",last:"Last"})
  => 3 columns, "(Index)" for the item index in the outer list, "first", "last" properties of the objects in the inner list
- Support column name filtering optional second argument:
  - console.table({first:"Joe",last:"Peck"}, {first:"First",last:"Last"}, ["first"])
  - console.table({first:"Joe",last:"Peck"}, {first:"First",last:"Last"}, "first")
  => 2 columns, "(Index)" for the item index in the outer list, "first" the property of the objects in the inner list
- Only support 10 properties / array indexes + the "(Index)" column
  - console.table([arrWith20Values, arrWith20Values])
  => 11 columns, "(Index)" for the item index in the outer list, "0".."9" for the indexes of the arrays

* NOTES
- One major advantage of console.table is being able to sort the output, so support sorting!
Comment 1 Radar WebKit Bug Importer 2015-01-29 16:09:06 PST
<rdar://problem/19655635>
Comment 2 Joseph Pecoraro 2015-01-29 16:15:14 PST
NOTE: Blink added a Command Line API shortcut "table" for "console.table"
<http://code.google.com/p/chromium/issues/detail?id=168776>
Comment 3 Joseph Pecoraro 2015-01-29 16:15:58 PST
<rdar://problem/13671069>
Comment 4 Joseph Pecoraro 2015-01-29 16:24:56 PST
Created attachment 245668 [details]
[IMAGE] Progress

This is what I have so far. Selection is a bit wonky. But it works pretty well! I need to add tests before putting up a patch.
Comment 5 Joseph Pecoraro 2015-01-29 16:40:19 PST
Created attachment 245670 [details]
[PATCH] Proposed Fix

Actually, tests here are not useful until we refactor ConsoleMessage logic into Model objects and View objects. Currently Test.js tests avoid Console tests for this, and testing at the inspector-protocol level is not particularly useful. We would just be testing that we get the "table". string...
Comment 6 Build Bot 2015-01-29 17:11:29 PST
Comment on attachment 245670 [details]
[PATCH] Proposed Fix

Attachment 245670 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/4803867996848128

New failing tests:
http/tests/inspector-protocol/access-inspected-object.html
Comment 7 Build Bot 2015-01-29 17:11:32 PST
Created attachment 245674 [details]
Archive of layout-test-results from ews103 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 8 Build Bot 2015-01-29 17:26:59 PST
Comment on attachment 245670 [details]
[PATCH] Proposed Fix

Attachment 245670 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5338354128257024

New failing tests:
http/tests/inspector-protocol/access-inspected-object.html
Comment 9 Build Bot 2015-01-29 17:27:02 PST
Created attachment 245677 [details]
Archive of layout-test-results from ews105 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 10 Joseph Pecoraro 2015-02-02 13:09:08 PST
http://trac.webkit.org/changeset/179493

I might have to rebaseline that one test. I'll watch for it.