Closed
Bug 1331586
Opened 8 years ago
Closed 8 years ago
JavaScript: <Class> is not defined for no obvious reason
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 1276469
People
(Reporter: ri.joel, Unassigned)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
Steps to reproduce:
Code:
<script>
(function () {
'use strict';
setTimeout(function () {
new B()
}, 0);
class B {}
})();
</script>
Actual results:
Error:
ReferenceError: B is not defined
Expected results:
No error at all.
The fun thing is that this problem happens only under certain circumstances. For example, if you add class A {} (which has nothing to do with B) anywhere before new B(), then the problem does not happen. Also, if you replace the callback function with an arrow function, the problem does not happen. Isn't that cool? :-)
This problem only happens in Firefox (also tested in Safari and Chrome).
Comment 1•8 years ago
|
||
Which version of Firefox did you use?
can you create a standalone testcase that the issue happens?
I've tested with HTML file with the contents only with <script>...</script> in your comment, on Firefox 50.1.0,
but I don't see any error message.
Flags: needinfo?(ri.joel)
Product: Firefox → Core
Updated•8 years ago
|
Component: Untriaged → JavaScript Engine
I also use 50.1.0. I will attach a test file & screenshot in a minute.
By the way, this problem was reported by a user. So it happens in at least two different Firefox instances.
Comment 6•8 years ago
|
||
thanks, tested with it again and it reproduced.
maybe my configuration wasn't really clean, sorry!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(ri.joel)
Comment 7•8 years ago
|
||
sounds like a dupe of bug 1276469, that is fixed in firefox 51, by bug 1263355.
Yes, seems likely. I will try to reproduce it in FF Developer Version.
Works as expected in 52.0a2 (2017-01-17). I am closing the issue.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•