All users were logged out of Bugzilla on October 13th, 2018

Avoid more removeEventListener calls when {once: true} can be used instead

RESOLVED FIXED in Firefox 54

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: florian, Assigned: florian)

Tracking

53 Branch
Firefox 54
Points:
---

Firefox Tracking Flags

(firefox54 fixed)

Details

Attachments

(3 attachments)

(Assignee)

Description

2 years ago
Created attachment 8830885 [details]
xpcshell script

The script used in bug 1331599 missed cases where the event listener was added and removed using a variable for the event name.
(Assignee)

Comment 1

2 years ago
Created attachment 8830892 [details] [diff] [review]
changes made by hand

This includes tweaks to the eslint rule, and changes that couldn't be handled by the script due to the capture value being in a variable.
Attachment #8830892 - Flags: review?(jaws)
(Assignee)

Updated

2 years ago
Assignee: nobody → florian
Status: NEW → ASSIGNED
(Assignee)

Comment 2

2 years ago
Created attachment 8830893 [details] [diff] [review]
script-generated patch
Attachment #8830893 - Flags: review?(jaws)
Attachment #8830892 - Flags: review?(jaws) → review+
Comment on attachment 8830893 [details] [diff] [review]
script-generated patch

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

r=me with the below code removed and the function name removed as well since it is no longer necessary.

::: b2g/components/ContentRequestHelper.jsm
@@ +39,5 @@
>        if (!msg || !msg.id || msg.id != id) {
>          deferred.reject("InternalErrorWrongContentEvent " +
>                          JSON.stringify(msg));
>          SystemAppProxy.removeEventListener(aContentEventName,
>                                             onContentEvent);

This is duplicate/unnecessary code?
Attachment #8830893 - Flags: review?(jaws) → review+
(Assignee)

Comment 4

2 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/b838ee5b00577a898bf66a3958736e0727c8b796
Bug 1334250 - adapt the no-useless-removeEventListener rule to handle the listener being added and removed with the same variable + some hand fixes, r=jaws.

https://hg.mozilla.org/integration/mozilla-inbound/rev/87fde7e63c1a0a7d808e2f178191f3187057c4e7
Bug 1334250 - script-generated patch to avoid removeEventListener calls when a variable is used for the event name, r=jaws.

Comment 5

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/b838ee5b0057
https://hg.mozilla.org/mozilla-central/rev/87fde7e63c1a
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox54: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 54
You need to log in before you can comment on or make changes to this bug.