Closed
Bug 928693
Opened 11 years ago
Closed 11 years ago
Use string.repeat(n) instead of (new Array(n + 1)).join(string)
Categories
(Thunderbird :: General, enhancement)
Thunderbird
General
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 27.0
People
(Reporter: aryx, Assigned: aryx)
Details
Attachments
(1 file, 1 obsolete file)
3.92 KB,
patch
|
Details | Diff | Splinter Review |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat It's faster, the code is shorter and no temporary is being used.
Attachment #819425 -
Flags: review?(mkmelin+mozilla)
Comment 1•11 years ago
|
||
Comment on attachment 819425 [details] [diff] [review] patch, v1 Review of attachment 819425 [details] [diff] [review]: ----------------------------------------------------------------- Looks goog to me! r=mkmelin ::: mailnews/extensions/newsblog/content/FeedItem.js @@ +353,5 @@ > let source = > openingLine + > 'X-Mozilla-Status: 0000\n' + > 'X-Mozilla-Status2: 00000000\n' + > + 'X-Mozilla-Keys: ' + " ".repeat(79) + '\n' + I think this one is actually supposed to be 80... ::: mailnews/extensions/newsblog/content/feed-subscriptions.js @@ +2021,5 @@ > > generateOutlineStruct: function(baseFolder, parent, indentLevel) > { > // Pretty printing. > + function indentString(len) { return " ".repeat(len - 2) }; add a ; after 2) while you're there
Attachment #819425 -
Flags: review?(mkmelin+mozilla) → review+
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #819425 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 3•11 years ago
|
||
https://hg.mozilla.org/comm-central/rev/23afadef993f
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 27.0
(In reply to Magnus Melin from comment #1) > Comment on attachment 819425 [details] [diff] [review] > patch, v1 > > Review of attachment 819425 [details] [diff] [review]: > ----------------------------------------------------------------- > > Looks goog to me! r=mkmelin > > ::: mailnews/extensions/newsblog/content/FeedItem.js > @@ +353,5 @@ > > let source = > > openingLine + > > 'X-Mozilla-Status: 0000\n' + > > 'X-Mozilla-Status2: 00000000\n' + > > + 'X-Mozilla-Keys: ' + " ".repeat(79) + '\n' + > > I think this one is actually supposed to be 80... the length should be 80; repeat(80) makes it 81.. it may break something later.
Assignee | ||
Comment 5•11 years ago
|
||
According to http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsMsgLocalFolderHdrs.h#36 , the part following "X-Mozilla-Keys: " should be 80 whitespaces long. This patch does that. The previous code only put 79 whitespaces there (joining an array of 80 items).
Comment 6•11 years ago
|
||
Yes, that's my understanding too.
hmm. prior to bug 761656 and the join, there was a : plus a space, plus 79 spaces. so it seems to have been wrong from the beginning, as a pop3 item is : plus space plus 80. in any case, just a note that it's now different than originally coded. and it seems irrelevant, as tags overflowing 80 are merely stored elsewhere, so the hardcoded header length seems anachronistic and an artifact from when there were the 5 labels.
You need to log in
before you can comment on or make changes to this bug.
Description
•