RESOLVED FIXED 152039
Web Inspector: console.dir should expand objects
https://bugs.webkit.org/show_bug.cgi?id=152039
Summary Web Inspector: console.dir should expand objects
Nikita Vasilyev
Reported 2015-12-08 22:48:33 PST
Created attachment 266970 [details] [Image] Actual/Expected See the attached image. console.log and console.dir of the following object shows a preview that isn't expandable (since it's lossless) and not very readable. [ { startOffset: 26, endOffset: 65, executionCount: 1 }, { startOffset: 66, endOffset: 76, executionCount: 1000 }, { startOffset: 77, endOffset: 84, executionCount: 1 }, { startOffset: 85, endOffset: 112, executionCount: 1000 }, { startOffset: 113, endOffset: 151, executionCount: 0 }, { startOffset: 152, endOffset: 161, executionCount: 1 }, { startOffset: 162, endOffset: 171, executionCount: 1000 }, { startOffset: 172, endOffset: 173, executionCount: 1 } ]) Arrays with less than 10 items seem to be always logged as unexpandable (lossless) preview. I had to add leading zeros to force it to be expandable. I suggest always expand objects logged with console.dir and keep console.log as is. This way it would be up to developers to decide which output they want.
Attachments
[Image] Actual/Expected (139.22 KB, image/png)
2015-12-08 22:48 PST, Nikita Vasilyev
no flags
Patch (1.60 KB, patch)
2019-08-22 15:33 PDT, Nikita Vasilyev
no flags
Radar WebKit Bug Importer
Comment 1 2015-12-08 22:48:50 PST
Nikita Vasilyev
Comment 2 2015-12-08 22:55:15 PST
Hm, I just realized that I should have used console.table for this particular example. Regardless of that, I often log objects with 10+ properties and there is no way to have them expanded by default.
Joseph Pecoraro
Comment 3 2015-12-09 11:41:50 PST
console.dir should always allow expanding regardless of the property of the object/array. So it seems that broke somewhere.
Nikita Vasilyev
Comment 4 2015-12-16 00:57:48 PST
*** This bug has been marked as a duplicate of bug 152328 ***
Nikita Vasilyev
Comment 5 2016-08-03 15:01:19 PDT
Not a duplicate, reopening. console.dir should EXPAND objects, not just allowing them to be expanded. For example, console.dir(window) should show window expanded.
Nikita Vasilyev
Comment 6 2019-08-22 15:33:15 PDT
Joseph Pecoraro
Comment 7 2019-08-22 15:34:57 PDT
Comment on attachment 377061 [details] Patch r=me!
WebKit Commit Bot
Comment 8 2019-08-22 16:17:52 PDT
Comment on attachment 377061 [details] Patch Clearing flags on attachment: 377061 Committed r249034: <https://trac.webkit.org/changeset/249034>
WebKit Commit Bot
Comment 9 2019-08-22 16:17:54 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.