Bug 143845

Summary: Web Inspector: Should include "Log Value" context menu item in Preview and Collapsed ObjectTree
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix timothy: review+

Description Joseph Pecoraro 2015-04-16 14:14:23 PDT
* SUMMARY
Should include "Log Value" context menu item in Preview and Collapsed ObjectTree.

For instance, if I console.log("onclick", event) and I see an event I am interested in, I want to just be able to right click it and "Log Value" to get a $n reference to poke around the object. Currently "Log Value" only happens for the properties inside the expanded event.
Comment 1 Radar WebKit Bug Importer 2015-04-16 14:14:49 PDT
<rdar://problem/20576655>
Comment 2 Joseph Pecoraro 2015-04-16 16:28:30 PDT
Created attachment 250975 [details]
[PATCH] Proposed Fix

NOTE: The previews inside of ObjectTreePropertyTreeElement don't get originating information because the TreeElement already handles context menus.
Comment 3 Timothy Hatcher 2015-04-16 16:34:23 PDT
Comment on attachment 250975 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=250975&action=review

> Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js:57
> +            this._previewView.setOriginatingObjectInfo(this._object, providedPropertyPath ? propertyPath : null);

Is providedPropertyPath just to avoid maybe passing a non-WebInspector.PropertyPath? The assert at the top should be enough.

Why not this._propertyPath?
Comment 4 Joseph Pecoraro 2015-04-16 17:45:37 PDT
(In reply to comment #3)
> Comment on attachment 250975 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250975&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js:57
> > +            this._previewView.setOriginatingObjectInfo(this._object, providedPropertyPath ? propertyPath : null);
> 
> Is providedPropertyPath just to avoid maybe passing a
> non-WebInspector.PropertyPath? The assert at the top should be enough.
> 
> Why not this._propertyPath?

If a property path was not provided, we provide a default root path of "this" and in that case I do not want to pass the property path along, because it won't be accurate. Only in the case where the ObjectTree was initialized with a property path will I pass it on. I could have written "var providedPropertyPath = !!propertyPath;" but chose the more explicit route.
Comment 5 Joseph Pecoraro 2015-04-16 17:46:51 PDT
Comment on attachment 250975 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=250975&action=review

> Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js:254
> +
> +        contextMenu.appendSeparator();

I have a feeling this separator is not actually needed and can be removed. I'll test.
Comment 6 Joseph Pecoraro 2015-04-16 18:01:43 PDT
http://trac.webkit.org/changeset/182933