Closed
Bug 1072477
Opened 11 years ago
Closed 11 years ago
EventTarget shim doesn't work if event listeners are removed while they are running
Categories
(Firefox :: Extension Compatibility, defect)
Tracking
()
RESOLVED
FIXED
Firefox 35
People
(Reporter: billm, Assigned: billm)
Details
Attachments
(1 file)
|
1.64 KB,
patch
|
mconley
:
review+
|
Details | Diff | Splinter Review |
I found this bug while writing the tests in bug 1072467. When the EventTarget shim is running listeners, it just iterates over them. This can break if one of the listeners calls removeEventListener. Here's what happens:
listeners = [#1, #2]
start running listener #1 at index 0
listener #1 removes itself
listeners = [#2]
in the next loop iteration, we try to run index 1 but it doesn't exist, so we stop, missing listener #2
The obvious fix is to copy the list before running the listeners.
Attachment #8494697 -
Flags: review?(wmccloskey)
| Assignee | ||
Comment 1•11 years ago
|
||
Comment on attachment 8494697 [details] [diff] [review]
fix-shim-listener-removal
Not sure how I did that.
Attachment #8494697 -
Flags: review?(wmccloskey) → review?(mconley)
Comment 2•11 years ago
|
||
Comment on attachment 8494697 [details] [diff] [review]
fix-shim-listener-removal
Review of attachment 8494697 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM - thanks billm.
Attachment #8494697 -
Flags: review?(mconley) → review+
| Assignee | ||
Comment 3•11 years ago
|
||
Comment 4•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 35
You need to log in
before you can comment on or make changes to this bug.
Description
•