WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
185156
JavaScriptCore should throw SyntaxError when a variable is already declared inside the "with" scope
https://bugs.webkit.org/show_bug.cgi?id=185156
Summary
JavaScriptCore should throw SyntaxError when a variable is already declared i...
baac
Reported
2018-04-30 20:07:27 PDT
Hi, there is an inconsistency when a variable is declared twice as "var" and "let" inside the "with" scope. JavaScriptCore should not accept the redeclaration and indicate an error. OS: Ubuntu 17.10 JavaScriptCore: 606.1.9.4 Step to reproduce: with({}) { var a; let a; } Actual result: Pass without failures Expected result: SyntaxError: Cannot declare a variable twice V8 and SpiderMonkey raises an exception as expected.
Attachments
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2018-04-30 22:30:20 PDT
This is surprising given: if (b) { var a; let a; } Is not a syntax error. Since with scopes don't require a block as their statement, e.g ```with({}) 20;``` is valid, I would guess this might be a bug in those other engines. Can you point me to where the spec says this should be a syntax error?
isol2
Comment 2
2018-08-08 08:57:46 PDT
Hi Saam, sorry for delay... baac left from our project she did not answered your question in time. We reported this issue on JSC and Chakra already confirmed after discussion (
https://github.com/Microsoft/ChakraCore/issues/5076
). Another similar case can be found in this code: { let x; eval('var x;'); } JSC and Chakra should not hoist the var past the let declaration without throwing redeclaration. V8 and Spidermonkey throws a SyntaxError as expected. cinfuzz
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug