RESOLVED FIXED 122867
Web Inspector: ES6: Improved Console Format for Set and Map Objects (like Arrays)
https://bugs.webkit.org/show_bug.cgi?id=122867
Summary Web Inspector: ES6: Improved Console Format for Set and Map Objects (like Arr...
Joseph Pecoraro
Reported 2013-10-15 15:21:57 PDT
JSC supports ES6 Set objects. We should have an improved Console Formatting for Sets, like we do Arrays. Currently the console.log is cumbersome. var set = new Set(1,2,1,2,3); // Possible UI: { 1, 2, 3 }
Attachments
[PATCH] Proposed Fix (87.70 KB, patch)
2015-01-26 19:50 PST, Joseph Pecoraro
joepeck: commit-queue-
[PATCH] Proposed Fix (87.86 KB, patch)
2015-01-27 14:55 PST, Joseph Pecoraro
timothy: review+
timothy: commit-queue-
Radar WebKit Bug Importer
Comment 1 2013-10-15 15:22:20 PDT
Timothy Hatcher
Comment 2 2013-10-16 11:25:59 PDT
{ 1, 2, 3 } sounds good, what about Maps? { foo: 1, bar: 2, bas: 3 }? Too much like an object literal?
Michał Gołębiowski-Owczarek
Comment 3 2014-04-29 01:38:07 PDT
(In reply to comment #2) > { 1, 2, 3 } sounds good, what about Maps? { foo: 1, bar: 2, bas: 3 }? Too much like an object literal? What about Maps with non-primitive keys? { foo: 1, { bar: 4 }: 2, bas: 3 }? Or will it just be omitted? Such a notation would create a weird case where map({ bar: 4 }) === undefined even though you see this object serialization in the console.
Joseph Pecoraro
Comment 4 2015-01-21 22:41:51 PST
I'll be doing this soon.
Joseph Pecoraro
Comment 5 2015-01-26 19:50:24 PST
Created attachment 245403 [details] [PATCH] Proposed Fix
WebKit Commit Bot
Comment 6 2015-01-26 19:51:51 PST
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Joseph Pecoraro
Comment 7 2015-01-26 19:53:12 PST
+ Some JavaScriptCore folks. Can you review the JSC WeakMapData portions of the patch? runtime/WeakMapData.h inspector/JSInjectedScriptHostPrototype.cpp: inspector/JSInjectedScriptHost.h: inspector/JSInjectedScriptHost.cpp:
Joseph Pecoraro
Comment 8 2015-01-26 19:56:40 PST
Comment on attachment 245403 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=245403&action=review > Source/JavaScriptCore/inspector/InjectedScriptSource.js:793 > + this.preview = this._generatePreview(object, objectGroupName, undefined, columnNames); Oops, this objectGroupName addition is now no longer necessary. I will remove it here and in subsequent sections. > Source/JavaScriptCore/inspector/InjectedScriptSource.js:966 > + _appendEntryPreviews: function(object, objectGroupName, preview) Like here, where it is no longer used.
Joseph Pecoraro
Comment 9 2015-01-26 23:53:28 PST
Comment on attachment 245403 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=245403&action=review > Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js:282 > - var lossless = this._appendObjectPreview(titleElement, obj); > + var lossless = this._appendPreview(titleElement, obj.preview); Oops, I think this will break iOS 7/8. I will have to augment the type/subtype/description onto the the preview for those. Should be easy: if (!preview.type) { preview.type = obj.type; preview.subtype = obj.subtype; } But maybe I should invest in creating a real WebInspector.ObjectPreview model object to abstract this away.
Joseph Pecoraro
Comment 10 2015-01-27 14:28:20 PST
Comment on attachment 245403 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=245403&action=review > LayoutTests/TestExpectations:101 > +# Garbage Collection is missing an object. > +webkit.org/b/140919 inspector/model/remote-object-weak-collection.html [ Skip ] We got to the bottom of this and can change the test to get consistent expected results. Unfortunately, I think I'll still need to skip the test because the bots still timeout randomly on inspector tests but bug 140919 has been closed.
Joseph Pecoraro
Comment 11 2015-01-27 14:55:51 PST
Created attachment 245475 [details] [PATCH] Proposed Fix
Timothy Hatcher
Comment 12 2015-01-27 23:02:21 PST
Comment on attachment 245475 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=245475&action=review > Source/JavaScriptCore/inspector/InjectedScriptSource.js:737 > + } > + return entries; Nit: Newline.
Joseph Pecoraro
Comment 13 2015-01-29 11:25:59 PST
Note You need to log in before you can comment on or make changes to this bug.