False SyntaxError on Sibling JS-Labels
Reported by
tatsuno_...@kurusugawa.jp,
Dec 21
|
||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
Steps to reproduce the problem:
1.Open Developer tool.
2.Paste the below code.
function zg(x) {
a: if (!x) b: { alert("foo"); }
else if (x && x.$classData) b: {
if (null !== x) {
alert("foo");
break b;
}
}
}
3. Run `zg("test")`
What is the expected behavior?
Chrome should not raise SyntaxError and execute the code, since the code seems valid on the ECMAScript spec.
http://www.ecma-international.org/ecma-262/#sec-labelled-statements-static-semantics-containsduplicatelabels
Other browsers (Firefox and Edge) can execute without Syntax Error.
What went wrong?
Chrome raises the following error.
Uncaught SyntaxError: Label 'b' has already been declared
at <anonymous>:1:1
Did this work before? N/A
Chrome version: 71.0.3578.98 (Official Build) (64 bit) (cohort: Stable) Channel: stable
OS Version: 10.0
Flash Version: 32.0.0.101
The code is minimum example.
Original code was generated by Scala.js and optimized by Google Closure Compiler on advanced optimization mode.
Please refer original issue reported on Scala.js repository.
https://github.com/scala-js/scala-js/issues/3508
,
Dec 21
,
Dec 21
tatsuno_yasuhiro@ Thanks for the issue. Able to reproduce this issue on Windows 10,Mac OS 10.13.6 and Ubuntu 17.10 on the latest Stable 71.0.3578.98 and latest Canary 73.0.3646.0. This is a Non-Regression issue as this behavior is observed from M-60 chrome builds. Attached is the screen shot for reference. Hence marking this as Untriaged for further updates from Dev. Thanks..
,
Dec 26
,
Dec 31
,
Jan 9
Further-minimized repro:
a: if (true) b: { }
else if (true) b: { }
,
Jan 10
I have a possible fix in progress at https://chromium-review.googlesource.com/c/v8/v8/+/1404176. CCing neis as he most-recently touched the labels code.
,
Jan 11
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/469754d01c5e7259ba3fd87b4e8dd102214feb24 commit 469754d01c5e7259ba3fd87b4e8dd102214feb24 Author: Adam Klein <adamk@chromium.org> Date: Fri Jan 11 17:40:18 2019 [parser] Allow same-named labelled blocks in if/else statements Bug: chromium:917215 Change-Id: Ie2127953a8ce3d6da4feb3478039ba318774e21d Reviewed-on: https://chromium-review.googlesource.com/c/1404176 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/master@{#58755} [modify] https://crrev.com/469754d01c5e7259ba3fd87b4e8dd102214feb24/src/parsing/parser-base.h [add] https://crrev.com/469754d01c5e7259ba3fd87b4e8dd102214feb24/test/mjsunit/regress/regress-917215.js
,
Jan 11
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by tatsuno_...@kurusugawa.jp
, Dec 21