<?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>202044</bug_id>
          
          <creation_ts>2019-09-20 05:49:01 -0700</creation_ts>
          <short_desc>Block scoped variables should be visible across scripts</short_desc>
          <delta_ts>2021-06-24 18:20:45 -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 12</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>macOS 10.14</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>193347</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=147813</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paulius Varna">paul.varna</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>mark.lam</cc>
    
    <cc>ross.kirsling</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1572727</commentid>
    <comment_count>0</comment_count>
    <who name="Paulius Varna">paul.varna</who>
    <bug_when>2019-09-20 05:49:01 -0700</bug_when>
    <thetext>Const and let should be scoped to global context if used in top level script. (warning, global context is not the same as global object).
Explanation: https://www.youtube.com/watch?v=5LEuJNLfLN0
Reproduction:

&lt;script&gt;
  var one = true;
  const two = true;
&lt;/script&gt;

&lt;script type=&quot;module&quot;&gt;
  var three = true;
  const four = true;
&lt;/script&gt;

&lt;script type=&quot;module&quot;&gt;
  console.log({ one });
  console.log({ two });
  console.log({ three }); // should throw
  console.log({ four }); // should throw
&lt;/script&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1572728</commentid>
    <comment_count>1</comment_count>
    <who name="Paulius Varna">paul.varna</who>
    <bug_when>2019-09-20 05:50:49 -0700</bug_when>
    <thetext>On Safari 12.1, 13 and 13.1 throws error at console.log({ two }). It shouldn&apos;t.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1572776</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-09-20 09:58:08 -0700</bug_when>
    <thetext>&lt;rdar://problem/55563029&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1772514</commentid>
    <comment_count>3</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2021-06-24 18:20:45 -0700</bug_when>
    <thetext>Fixed in bug 193347

*** This bug has been marked as a duplicate of bug 193347 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>