Closed Bug 1072607 Opened 7 years ago Closed 7 years ago

Event shim doesn't handle removeEventListener correctly

Categories

(Firefox :: Extension Compatibility, defect)

34 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 35

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file)

This was a really stupid bug that I found while debugging the session store tests. It's a regression from bug 1059207. The code there looked like this:

    let listener = (event) => this.handleEvent(useCapture, event);
    if (register) {
      this._childGlobal.addEventListener(eventType, listener, useCapture, true);
    } else {
      this._childGlobal.removeEventListener(eventType, listener, useCapture);
    }

The problem is that we get a new closure for listener each time. The removeEventListener call won't remove anything, since the new closure was never a listener. Bug 1072467 includes a test for this.
Attachment #8494789 - Flags: review?(mconley)
Comment on attachment 8494789 [details] [diff] [review]
fix-capturing-regression

Review of attachment 8494789 [details] [diff] [review]:
-----------------------------------------------------------------

Ouch, sorry for missing that during my review, and good catch.
Attachment #8494789 - Flags: review?(mconley) → review+
https://hg.mozilla.org/mozilla-central/rev/70ea9e678878
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 35
You need to log in before you can comment on or make changes to this bug.