Use Array.includes in mail/ instead of indexOf != / == -1

RESOLVED FIXED in Thunderbird 44.0

Status

Thunderbird
General
--
enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: aryx, Assigned: aryx)

Tracking

Trunk
Thunderbird 44.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 8664510 [details] [diff] [review]
patch, v1

Try run: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=279ea57731dc
Attachment #8664510 - Flags: review?(mkmelin+mozilla)

Updated

2 years ago
Attachment #8664510 - Flags: review?(mkmelin+mozilla) → review+
https://hg.mozilla.org/comm-central/rev/0c9f89670ac8
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 44.0

Comment 2

2 years ago
Did you do this with a script? If yes, can we run it on im/ and chat/ too? ;)

Comment 3

2 years ago
Just out of interest: What's the practical value of this?
According to this
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
it's experimental and was introduced at gecko43.
From bug 1208849 comment 0:
> [...] I do this for relaxing and looking at code to learn and spot other bugs (found bug 1207364 that way).

> According to this
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
> Global_Objects/Array/includes
> it's experimental and was introduced at gecko43.
It landed much earlier but was only enabled in Nightly. It does what String.prototype.includes does (available since Gecko 40) and the goal was to assign both methods the same name. So there was time for adaption to get tracktion and testing when it was enabled on Nightly.

Comment 5

2 years ago
(In reply to Jorg K (GMT+2) from comment #3)
> Just out of interest: What's the practical value of this?

It makes the code more readable, imho.
You need to log in before you can comment on or make changes to this bug.