<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>185156</bug_id>
          
          <creation_ts>2018-04-30 20:07:27 -0700</creation_ts>
          <short_desc>JavaScriptCore should throw SyntaxError when a variable is already declared inside the &quot;with&quot; scope</short_desc>
          <delta_ts>2018-08-08 08:57:46 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>baac</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>isol2</cc>
    
    <cc>mark.lam</cc>
    
    <cc>saam</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1419235</commentid>
    <comment_count>0</comment_count>
    <who name="">baac</who>
    <bug_when>2018-04-30 20:07:27 -0700</bug_when>
    <thetext>Hi,

there is an inconsistency when a variable is declared twice as &quot;var&quot; and &quot;let&quot; inside the &quot;with&quot; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1419263</commentid>
    <comment_count>1</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-04-30 22:30:20 -0700</bug_when>
    <thetext>This is surprising given:

if (b) {
    var a;
    let a;
}

Is not a syntax error. Since with scopes don&apos;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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448758</commentid>
    <comment_count>2</comment_count>
    <who name="">isol2</who>
    <bug_when>2018-08-08 08:57:46 -0700</bug_when>
    <thetext>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(&apos;var x;&apos;);
}

JSC and Chakra should not hoist the var past the let declaration without throwing redeclaration. V8 and Spidermonkey throws a SyntaxError as expected.


cinfuzz</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>