Changeset 194149 in webkit
- Timestamp:
- Dec 16, 2015 9:40:15 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r194143 r194149 1 2015-12-16 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Typing object literal in the console causes a parse error 4 https://bugs.webkit.org/show_bug.cgi?id=141737 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/controller/runtime-controller-expected.txt: Added. 9 * inspector/controller/runtime-controller.html: Added. 10 1 11 2015-12-08 Sergio Villar Senin <svillar@igalia.com> 2 12 -
trunk/Source/WebInspectorUI/ChangeLog
r194148 r194149 1 2015-12-16 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Typing object literal in the console causes a parse error 4 https://bugs.webkit.org/show_bug.cgi?id=141737 5 6 Reviewed by Timothy Hatcher. 7 8 Provide a convenience in console evaluations for JSON object like input. 9 If the console input starts with '{' and ends with '}' wrap the input 10 in parenthesis to force evaluation as an expression. 11 12 For example, input "{a:1}" would be convenience wrapped to "({a:1})" 13 and produce the expected object. This helps avoid the unusual treatment 14 of "{a:1}" as program containing a labeled statement, which is often 15 not what the user expects. And in more realistic cases, like "{a:1, b:2}", 16 produce a SyntaxError. 17 18 * UserInterface/Controllers/RuntimeManager.js: 19 (WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow): 20 Detect and convenience wrap the given expression. 21 1 22 2015-12-16 Joseph Pecoraro <pecoraro@apple.com> 2 23 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js
r192383 r194149 41 41 // There is no expression, so the completion should happen against global properties. 42 42 expression = "this"; 43 } else if (/^\s*\{/.test(expression) && /\}\s*$/.test(expression)) { 44 // Transform {a:1} to ({a:1}) so it is treated like an object literal instead of a block with a label. 45 expression = "(" + expression + ")"; 43 46 } 44 47
Note: See TracChangeset
for help on using the changeset viewer.