New issue
Advanced search Search tips

Issue 917215 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 11
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

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
 
IMPORTANT NOTE:
If label `a:` is removed, Chrome run the code without SyntaxError.
Labels: Needs-Triage-M71
Cc: susan.boorgula@chromium.org
Components: Platform>DevTools
Labels: Triaged-ET Target-73 M-73 FoundIn-71 FoundIn-73 FoundIn-72 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
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..
917215-M60.PNG
51.2 KB View Download
Components: -Platform>DevTools -Blink Blink>JavaScript
Components: -Blink>JavaScript Blink>JavaScript>Language
Status: Available (was: Untriaged)
Owner: adamk@chromium.org
Status: Assigned (was: Available)
Further-minimized repro:

a: if (true) b: { }
else if (true) b: { }

Cc: neis@chromium.org
Status: Started (was: Assigned)
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.
Project Member

Comment 8 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)

Sign in to add a comment