Bug 168873

Summary: Web Inspector: console.table(): Silently hiding some columns + Key's 'name' can trigger
Product: WebKit Reporter: ar <webkitbugs>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, inspector-bugzilla-changes, joepeck, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: All   
OS: OS X 10.11   
Attachments:
Description Flags
Test case none

Description ar 2017-02-25 17:08:12 PST
# Description:
- Running `console.table()` (in the Console) silently hides some columns.
- I know there's a hard-coded limit ("maxColumnsToRender"), but I can trigger the bug without running into that limit.
- I can't figure out the exact pattern (more below), but there seems to be something about Key names (as strings) being letters vs. numbers.



# Reproduce:
- Run console.table() on an array of objects with more than 10 key/value pairs.
- Run console.table() with the "Restricting the columns displayed" argument set to one of the hidden columns.
- Run my test case (attached) which console.table()'s over 8 demo arrays with real content.
	- Open the test case in the Safari Console.
	- Each case is annotated.



# Actual:
- Columns are silently *not displayed*. There's no indication that they were suppressed.
	- IOW: If your array is 13 columns, only 10 will display, and Safari won't say anything about those 3x columns that were not shown.
- The most reduced cases are 3/3b and 4/5. These are 13 column arrays I built just to try to isolate this. Given the max limit, I understand why columns 11, 12, 13 are not displayed.
	- Although it would be nice if that Max could be adjusted, or at the least, be easier to learn about :-)
- The weirdest cases are 1 and 2.
	- This is somewhat from my original data where I discovered the bug.
	- I started adjusting the keys value and removing items from each object until the bug went away.
	- The only difference between `var testArr_8col` and `var testArrBug_8col` is the name of the third key:
		- `testArr_8col` 3rd key name = "3"
		- `testArrBug_8col`3rd key name = "Guest"
	- I've found it has something to do with the key name being a number vs. letter.
		- Number = OK
		- Letter = Triggers Bug!
	- I wouldn't think that would matter, since the key is always a string (wrapped in quote marks). But wuduino?
	- It's not a length thing either, since I can make the key "333333333" and it's fine. But if I change it to "a" the bug is triggered.
- The "Restricting the columns displayed" argument <https://developer.mozilla.org/en-US/docs/Web/API/Console/table#Restricting_the_columns_displayed> is also affected by this issue.
	- Meaning: When this argument is set, the cell contents of an auto-hidden column (aka: The Bug) are shown as "-", and not their actual value.



# Expected:
- It should print all of the columns, within reason.
	- If there *is* some hard-coded limit, it would be helpful if there was some indication that additional columns were not displayed because of a Safari limit... Not a bug in the developers code :-)
- There should be some consistency to the column limit. IOW: I am able to trigger this bug with an 8 column table (only 7 displayed) and a 13 column table (only 10 displayed).
- Is there any documentation about WebKit + console.table() ?
	- This is all that I've been able to find re: Column number limits:
		- <https://bugs.webkit.org/show_bug.cgi?id=167175>
		- <https://bugzilla.mozilla.org/show_bug.cgi?id=899753#c37>


# Notes:
- Safari Version 10.0.3 (11602.4.8.0.1), OS 10.11.6.
	- Sorry I don't have 10.12.x to test.
	- Apologies if this has already been fixed.
- Chrome doesn't exhibit any of this. I've tested up to 20 columns there.
- Here's the closest related reports I was able to find, but they mostly deal with the max limit and not the "key name as letter vs. number" issue:
	- Bug 114810 <https://bugs.webkit.org/show_bug.cgi?id=114810>
	- Bug 167175 <https://bugs.webkit.org/show_bug.cgi?id=167175>
- Re: "maxColumnsToRender = 15":
	- I found this too: https://github.com/WebKit/webkit/commit/859894843dc06e40dc998e4fccdcf30c01163089#diff-0fee7706d13c90c6985b4ebddde0c20e
	- There's something here about the "front end" limiting to "5" while the backend processes "10". Maybe this has something to do with 1/2 of the issues I'm seeing?


Thanks!
Comment 1 ar 2017-02-25 17:10:11 PST
Created attachment 302765 [details]
Test case

8x console.table() examples, with annotations
Comment 2 Radar WebKit Bug Importer 2017-02-26 22:04:21 PST
<rdar://problem/30727943>
Comment 3 Joseph Pecoraro 2017-03-22 13:16:55 PDT
The test case looks as expected to me in the Safari Technology Preview.

Do you still see any issues when using the Safari Technology Preview?
Comment 4 ar 2017-03-22 19:13:31 PDT
Thanks for checking.

Unfortunately I can't test in the latest Safari Technology Preview because I haven't upgraded to Sierra yet.

The issue *is* there in STP "Release 16 (Safari 10.1, WebKit 11603.1.10)" (which is the last version that runs in 10.11.6) and the release version "10.0.3 (11602.4.8.0.1)".

Do you *see* the issue in the release version above and/or the release version in Sierra 10.12.x?
Comment 5 Joseph Pecoraro 2017-03-22 20:22:30 PDT
I suspect this was fixed by:
<https://webkit.org/b/167175> Web Inspector: console.table only works for the first 5 properties
<http://trac.webkit.org/changeset/210910>

Which is only a few months old. So probably past STP 16.

You can try a WebKit Nightly on El Capitan. Click the download links in the "WebKit Nightly" section on:
<https://webkit.org/downloads/>
Comment 6 ar 2017-03-25 08:22:37 PDT
> I suspect this was fixed by:
> <https://webkit.org/b/167175> Web Inspector: console.table only works for the first 5 properties
> <http://trac.webkit.org/changeset/210910>

Yeah. I referenced in my original report. It looked promising.

> Which is only a few months old. So probably past STP 16.

> You can try a WebKit Nightly on El Capitan. Click the download links in the "WebKit Nightly" section on: <https://webkit.org/downloads/>

Ahh. I didn't realize that.

A few things:
- Tested in Nightly r214393 (March 25, 2017 8:37 AM GMT)

- I can confirm all of my original test cases PASS now.

- I can now see up to 15 columns, which makes sense given:
	- var maxColumnsToRender = 15;
	- via: https://bugs.webkit.org/attachment.cgi?id=299184&action=diff#a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js_sec1
	- 16+ columns are silently suppressed (as before).

- Setting the "Column Display Restriction" argument to a column above 15 (front end cut-off) works correctly now too! (My tests: 2b, 3b).

This is great.
Thanks!

Now my only request would be: More documentation about this.

- I wasn't able to find anything about this limitation, except in <https://bugs.webkit.org/show_bug.cgi?id=167175> and the source. So adding a note about this to some documentation, somewhere, would be nice :-)

- Even better: A message that appears when column display has been suppressed. Even if it's just a warning or note about the `Max=15` limitation.

Thanks again!
Comment 7 ar 2017-03-25 08:22:37 PDT
> I suspect this was fixed by:
> <https://webkit.org/b/167175> Web Inspector: console.table only works for the first 5 properties
> <http://trac.webkit.org/changeset/210910>

Yeah. I referenced in my original report. It looked promising.

> Which is only a few months old. So probably past STP 16.

> You can try a WebKit Nightly on El Capitan. Click the download links in the "WebKit Nightly" section on: <https://webkit.org/downloads/>

Ahh. I didn't realize that.

A few things:
- Tested in Nightly r214393 (March 25, 2017 8:37 AM GMT)

- I can confirm all of my original test cases PASS now.

- I can now see up to 15 columns, which makes sense given:
	- var maxColumnsToRender = 15;
	- via: https://bugs.webkit.org/attachment.cgi?id=299184&action=diff#a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js_sec1
	- 16+ columns are silently suppressed (as before).

- Setting the "Column Display Restriction" argument to a column above 15 (front end cut-off) works correctly now too! (My tests: 2b, 3b).

This is great.
Thanks!

Now my only request would be: More documentation about this.

- I wasn't able to find anything about this limitation, except in <https://bugs.webkit.org/show_bug.cgi?id=167175> and the source. So adding a note about this to some documentation, somewhere, would be nice :-)

- Even better: A message that appears when column display has been suppressed. Even if it's just a warning or note about the `Max=15` limitation.

Thanks again!
Comment 8 Brian Burg 2017-03-25 14:14:27 PDT
Marking as resolved. I'll make sure to note this limitation in documentation of Console API.