Bug 158548

Summary: REGRESSION: Web Inspector: Should be able to evaluate "{a:1, b:2}" in the console
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2016-06-08 15:46:11 PDT
* Summary
Web Inspector: Should be able to evaluate "{a:1, b:2}" in the console

* Notes
- Looks like this regressed when adding the console evaluation names
- The sourceURL is appended to the evaluation text before runtime manager has looked at it
- And runtime manager is where we add the convenience

>     consolePromptTextCommitted(prompt, text)
>     {
>         ...
>         text = appendWebInspectorConsoleEvaluationSourceURL(text);
> 
>         WebInspector.runtimeManager.evaluateInInspectedWindow(text, WebInspector.RuntimeManager.ConsoleObjectGroup, true, false, false, true, true, printResult.bind(this));
>     }

>    evaluateInInspectedWindow(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, callback)
>    {
>        if (!expression) {
>            // There is no expression, so the completion should happen against global properties.
>            expression = "this";
>        } else if (/^\s*\{/.test(expression) && /\}\s*$/.test(expression)) {
>            // Transform {a:1} to ({a:1}) so it is treated like an object literal instead of a block with a label.
>            expression = "(" + expression + ")";
>        }
>        ...
Comment 1 Joseph Pecoraro 2016-06-08 15:47:05 PDT
Lets just move the convenience to consolePromptTextCommitted. It really is the only place I think we expect this to happen right now.
Comment 2 Radar WebKit Bug Importer 2016-06-08 15:49:13 PDT
<rdar://problem/26708513>
Comment 3 Joseph Pecoraro 2016-06-08 18:45:48 PDT
Created attachment 280866 [details]
[PATCH] Proposed Fix
Comment 4 WebKit Commit Bot 2016-06-08 23:19:26 PDT
Comment on attachment 280866 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 280866

Committed r201855: <http://trac.webkit.org/changeset/201855>
Comment 5 WebKit Commit Bot 2016-06-08 23:19:30 PDT
All reviewed patches have been landed.  Closing bug.