Bug 126855

Summary: Web Inspector: scope chain details sidebar doesn't update values modified via console
Product: WebKit Reporter: BJ Burg <bburg>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: chrisjshull, commit-queue, joepeck, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description BJ Burg 2014-01-12 14:50:20 PST
Test case:

when paused, add a new property to some object visible in the scope chain details sidebar. The new property won't be added to the tree until you take a step in the debugger.
Comment 1 Radar WebKit Bug Importer 2014-01-12 14:50:38 PST
<rdar://problem/15801345>
Comment 2 Chris J. Shull 2014-02-13 16:16:41 PST
Created attachment 224125 [details]
Patch
Comment 3 Timothy Hatcher 2014-02-13 19:16:48 PST
Comment on attachment 224125 [details]
Patch

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

Thanks for looking into this!

> Source/WebInspectorUI/UserInterface/JavaScriptLogViewController.js:228
> +            WebInspector.scopeChainDetailsSidebarPanel.needsRefresh();

This would be better as an event that the sidebar observes. Having this low-level view class directly call a higher-level class is a layering violation.

RuntimeManager would be a good place to fire the event that the sidebar observes.
Comment 4 Timothy Hatcher 2014-02-13 19:19:12 PST
Having RuntimeManager fire it after doing an evaluate would catch any other place we evaluate expressions.
Comment 5 Chris J. Shull 2014-02-13 23:12:35 PST
Created attachment 224166 [details]
Patch
Comment 6 Chris J. Shull 2014-02-13 23:14:36 PST
Thanks for the feedback, uploaded new patch.

Two things I wasn’t sure about:
1) I didn’t add any data to the event, since it seems like most events don’t include data unless something will use it. Happy to add if you want though.
2) I didn’t refactor RuntimeManager#evaluateInInspectedWindow() to not have a callback at all, since having a callback made more sense for the things which were calling that method (since they needed to have callbacks specific to the invocation, as opposed to generic like the event is used.) Plus, one of the other args changes what args get passed to the callback.
Comment 7 Joseph Pecoraro 2014-02-14 10:44:50 PST
Comment on attachment 224166 [details]
Patch

You need to bind.(this) on both evalCallback calls. There is one on RuntimeManager.js a few lines down (line 75 after your patches). Otherwise, just typing in the console normally (not paused) will throw an exception right?
Comment 8 Chris J. Shull 2014-02-14 10:55:28 PST
Created attachment 224233 [details]
Patch
Comment 9 Chris J. Shull 2014-02-14 10:55:54 PST
Yikes! Thank you for catching that.
Patch updated.
Comment 10 WebKit Commit Bot 2014-02-15 00:23:36 PST
Comment on attachment 224233 [details]
Patch

Clearing flags on attachment: 224233

Committed r164163: <http://trac.webkit.org/changeset/164163>
Comment 11 WebKit Commit Bot 2014-02-15 00:23:38 PST
All reviewed patches have been landed.  Closing bug.