WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 142567
151365
Problem with ES6 class definition inside of function definition
https://bugs.webkit.org/show_bug.cgi?id=151365
Summary
Problem with ES6 class definition inside of function definition
Dan Bornstein
Reported
2015-11-17 15:25:31 PST
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 <
http://milk.com/mimu/awkward-js-music/
>. Expected Results: Embedded canvases should be rendered, and "play / pause" button should work. Actual Results: Message to console: "ReferenceError: Can't find variable: StyleUtil -- cloneComputedStyle -- StyleUtil.js:39" 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'm continuing development of the code. Here's a snapshot of the source as of this report: <
https://github.com/danfuzz/mimu/tree/6042dc4014211eed2ba75354e5ed5361b998f07a
> 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't work in FireFox in that FireFox doesn'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.
Attachments
Add attachment
proposed patch, testcase, etc.
Dan Bornstein
Comment 1
2015-11-17 15:28:58 PST
Here's the version of StyleUtil.js in question: <
https://github.com/danfuzz/mimu/blob/6042dc4014211eed2ba75354e5ed5361b998f07a/lib/StyleUtil.js
>
Joseph Pecoraro
Comment 2
2016-05-05 22:28:23 PDT
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's Name from inside the class'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
***
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