Closed Bug 1560550 Opened 5 months ago Closed 5 months ago

Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM

Categories

(SeaMonkey :: General, task)

task
Not set

Tracking

(seamonkey2.49esr wontfix, seamonkey2.53? fixed, seamonkey2.57esr+ fixed, seamonkey2.63 unaffected)

RESOLVED FIXED
seamonkey2.66
Tracking Status
seamonkey2.49esr --- wontfix
seamonkey2.53 ? fixed
seamonkey2.57esr + fixed
seamonkey2.63 --- unaffected

People

(Reporter: iann_bugzilla, Assigned: iann_bugzilla)

Details

Attachments

(4 files, 1 obsolete file)

Switching from foo.indexOf(...) == -1 to foo.includes() happened back in 60 for m-c, we should probably do it for SM.

Attached patch Make use of foo.includes() (obsolete) — Splinter Review
Assignee: nobody → iann_bugzilla
Status: NEW → ASSIGNED
Attachment #9073323 - Flags: review?(frgrahl)

Missed one entry, changes to test files will be in another patch

Attachment #9073323 - Attachment is obsolete: true
Attachment #9073323 - Flags: review?(frgrahl)
Attachment #9073324 - Flags: review?(frgrahl)
Attachment #9073326 - Flags: review?(frgrahl)
Comment on attachment 9073324 [details] [diff] [review]
Make use of foo.includes()

r+ it is
Attachment #9073324 - Flags: review?(frgrahl) → review+
Comment on attachment 9073326 [details] [diff] [review]
Use foo.includes() in test files

r+ it is
Attachment #9073326 - Flags: review?(frgrahl) → review+

Hi enter too fast

suite/mailnews/content/msgMail3PaneWindow.js

  •            if (hdrs && hdrs.indexOf("X-attachment-size:") > 0) {
    
  •            if (hdrs && hdrs.includes("X-attachment-size:")) {
    

Is this ok IndexOf would return 0 for the first element but here this would be true if only one hdrs.

r/a+ Minor rebase for 2.53 and 2.57. Same question about > 0

Attachment #9073870 - Flags: review+
Attachment #9073870 - Flags: approval-comm-release+
Attachment #9073870 - Flags: approval-comm-esr60+
Comment on attachment 9073326 [details] [diff] [review]
Use foo.includes() in test files

a+ fror 2.57
Attachment #9073326 - Flags: approval-comm-esr60+

r+/a+ for 2.53

Attachment #9073872 - Flags: review+
Attachment #9073872 - Flags: approval-comm-release+

(In reply to Frank-Rainer Grahl (:frg) from comment #6)

Hi enter too fast

suite/mailnews/content/msgMail3PaneWindow.js

  •            if (hdrs && hdrs.indexOf("X-attachment-size:") > 0) {
    
  •            if (hdrs && hdrs.includes("X-attachment-size:")) {
    

Is this ok IndexOf would return 0 for the first element but here this would be true if only one hdrs.

As far as I can tell, this code is just looking to see if the headers contain the string, not sure why it originally thought finding it at position zero was wrong. Maybe a typo?

Pushed by frgrahl@gmx.net:
https://hg.mozilla.org/comm-central/rev/708b5e8fcaa6
Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM. r=frg
https://hg.mozilla.org/comm-central/rev/d04da3816b8e
Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM - test files. r=frg

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED

https://hg.mozilla.org/releases/comm-esr60/rev/845d89795eb18dfad50db07602dd809e20c0af7b
Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM. r=frg a=frg
https://hg.mozilla.org/releases/comm-esr60/rev/1820ce6af1a84ad3ff50c8866262b9e6ae82b1cf
Port |Bug 1339461 - Convert foo.indexOf(...) == -1 to foo.includes()| to SM - test files. r=frg a=frg

You need to log in before you can comment on or make changes to this bug.