Closed
Bug 1072932
Opened 10 years ago
Closed 10 years ago
TDZ buglet in test_eventemitter_basic.html
Categories
(DevTools :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 35
People
(Reporter: tromey, Assigned: tromey)
References
Details
Attachments
(1 file)
1.50 KB,
patch
|
past
:
review+
|
Details | Diff | Splinter Review |
I had a "try" build fail in test_eventemitter_basic.html.
The error says in part:
ReferenceError: can't access let declaration `beenHere1' before initialization: next@chrome://mochitests/content/chrome/toolkit/devtools/tests/mochitest/test_eventemitter_basic.html:61:14
ReferenceError: can't access let declaration `beenHere1' before initialization: next@chrome://mochitests/content/chrome/toolkit/devtools/tests/mochitest/test_eventemitter_basic.html:61:14
Looking at `beenHere1' I see:
function testEmitter(aObject) {
...
emitter.on("next", next);
emitter.emit("next", "abc", "def");
let beenHere1 = false;
function next(eventName, str1, str2) {
...
So I think that `beenHere1' is calling into the "temporal dead zone":
depending on the circumstances, `next' may be called before `beenHere1'
has been bound.
The fix is to hoist the `let' up above the call to `emitter.on'.
I'll attach a patch momentarily.
Assignee | ||
Comment 1•10 years ago
|
||
I hoisted "beenHere2" as well since it seemed possible for "onlyOnce"
to be called before that let binding was seen.
I looked at the other files in this directory and everything else was
fine.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → ttromey
Assignee | ||
Updated•10 years ago
|
Attachment #8495260 -
Flags: review?(past)
Comment 2•10 years ago
|
||
Comment on attachment 8495260 [details] [diff] [review]
hoist "let"s to avoid the TDZ
Review of attachment 8495260 [details] [diff] [review]:
-----------------------------------------------------------------
Nice, I've seen that error recently myself.
Attachment #8495260 -
Flags: review?(past) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 3•10 years ago
|
||
Flags: in-testsuite+
Keywords: checkin-needed
Comment 4•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 35
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•