<?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>151365</bug_id>
          
          <creation_ts>2015-11-17 15:25:31 -0800</creation_ts>
          <short_desc>Problem with ES6 class definition inside of function definition</short_desc>
          <delta_ts>2016-05-05 22:28:23 -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 9</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.10</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>142567</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>140491</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dan Bornstein">danfuzz</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>keith_miller</cc>
    
    <cc>rniwa</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1142687</commentid>
    <comment_count>0</comment_count>
    <who name="Dan Bornstein">danfuzz</who>
    <bug_when>2015-11-17 15:25:31 -0800</bug_when>
    <thetext>When using the ES6 class definition syntax in the scope of a function, it looks like static definitions might not quite work. I am not 100% sure what the exact trigger is, but I do have a case right now that consistently fails.

Steps to Reproduce:
1. Open Safari.
2. Visit &lt;http://milk.com/mimu/awkward-js-music/&gt;.

Expected Results:
Embedded canvases should be rendered, and &quot;play / pause&quot; button should work.

Actual Results:
Message to console: &quot;ReferenceError: Can&apos;t find variable: StyleUtil -- cloneComputedStyle -- StyleUtil.js:39&quot;

Notably, the line that is being complained about is within the definition of the class StyleUtil. Given that cloneComputedStyle does exist in that class, the lookup should not ever fail.

I&apos;m continuing development of the code. Here&apos;s a snapshot of the source as of this report: &lt;https://github.com/danfuzz/mimu/tree/6042dc4014211eed2ba75354e5ed5361b998f07a&gt;

Three items of note:

* This bug showed up after I wrapped the definition of the class in a function definition (as part of a conversion to RequireJS).
* The code as currently written works in Chrome. It doesn&apos;t work in FireFox in that FireFox doesn&apos;t do the ES6 class syntax at all yet (at least not in the release build).
* If you clone the source locally and view the index.html file in Safari, then *sometimes* the bug will show up, and sometimes the page will operate properly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1142688</commentid>
    <comment_count>1</comment_count>
    <who name="Dan Bornstein">danfuzz</who>
    <bug_when>2015-11-17 15:28:58 -0800</bug_when>
    <thetext>Here&apos;s the version of StyleUtil.js in question: &lt;https://github.com/danfuzz/mimu/blob/6042dc4014211eed2ba75354e5ed5361b998f07a/lib/StyleUtil.js&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1190618</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2016-05-05 22:28:23 -0700</bug_when>
    <thetext>Looks like this works now in trunk (and Safari Technology Preview / WebKit Nightly if you want to verify).

I believe this was the Class Name Scope change, since it looks like that is what was on line 39 (accessing the Class&apos;s Name from inside the class&apos;s block). Though I think that was, maybe you had tested in Safari and not a WebKit Nightly at the time.

    ES6 class syntax should use block scoping
    https://bugs.webkit.org/show_bug.cgi?id=142567

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

    </bug>

</bugzilla>