Issue metadata
Sign in to add a comment
|
devtools forcing auto params for /\{.*\}/ breaks some inputs
Reported by
kolodny....@gmail.com,
Apr 15 2016
|
||||||||||||||||||||||
Issue description
Chrome Version : 49.0.2623.112 (Official Build) m (64-bit)
URLs (if applicable) :
What steps will reproduce the problem?
(1) Open the devtools
(2) Go to the console tab and type:
(3) {a:1}),({b:2}
What is the expected result?
It should throw a syntax error
What happens instead?
It displays Object {b: 2}
Please provide any additional information below. Attach a screenshot if
possible.
I think it would make sense to try to first parse it by itself and see if it is a syntax error before doing the auto params, something as simple as Function(expression) should do the trick. Note that this will also solve for the problem of this input:
{let a = 4; console.log(a)}
So far the only way I've found to get around this is to do something like this:
/**/ {let a = 4; console.log(a)}
,
Apr 16 2016
,
Apr 17 2016
This will be fixed by https://codereview.chromium.org/1875903002/patch/80001/90004
,
Apr 29 2016
Merging these to get it out of our bucket. #3 Confirmed it should fix it.
,
Jul 12 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fdaeccea42f63fa0836a814a80b02ac71433d385 commit fdaeccea42f63fa0836a814a80b02ac71433d385 Author: dgozman <dgozman@chromium.org> Date: Tue Jul 12 19:16:21 2016 [DevTools] Better heuristic for detecting object literals. Improved heuristic for detecting object literals. Previously valid blocks were detected as object literals and wrapped in parentheses. Based on the patch by zirakertan@gmail.com: https://codereview.chromium.org/1875903002/ BUG= 499864 , 603890 NOTRY=true Review-Url: https://codereview.chromium.org/2135853002 Cr-Commit-Position: refs/heads/master@{#404819} [modify] https://crrev.com/fdaeccea42f63fa0836a814a80b02ac71433d385/third_party/WebKit/LayoutTests/inspector/console/console-eval-object-literal-expected.txt [modify] https://crrev.com/fdaeccea42f63fa0836a814a80b02ac71433d385/third_party/WebKit/LayoutTests/inspector/console/console-eval-object-literal.html [modify] https://crrev.com/fdaeccea42f63fa0836a814a80b02ac71433d385/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by kolodny....@gmail.com
, Apr 15 2016To solve for the let case, it should also check if adding the params would create a syntax error: Function('(' + expression + ')') and if so don't add them