Bug 1544834 - Replace non-test uses of deprecated Array generics r=evilpie,dao

- `Array.forEach` becomes for-of loop or `array.forEach`.
- `Array.slice(a)` or `Array.slice(a, 0)` becomes `Array.from(a)`.
- `Array.map` becomes `Array.from`
- `Array` copy + concatenation becomes Array literal + spread syntax.
- All other `Array.X(a, ...)` become `Array.prototype.X.call` or `Array.from(a).X(...)`

Differential Revision: https://phabricator.services.mozilla.com/D27802
This commit is contained in:
Rob Wu
2019-04-17 19:03:17 +00:00
parent 06adec8aee
commit 731bc4cb2e
27 changed files with 51 additions and 47 deletions

View File

@@ -295,8 +295,9 @@ DownloadsPlacesView.prototype = {
},
get selectedNodes() {
return Array.filter(this._richlistbox.selectedItems,
element => element._shell.download.placesNode);
return Array.prototype.filter.call(
this._richlistbox.selectedItems,
element => element._shell.download.placesNode);
},
get selectedNode() {
@@ -501,14 +502,15 @@ DownloadsPlacesView.prototype = {
case "downloadsCmd_clearDownloads":
return this.canClearDownloads(this._richlistbox);
default:
return Array.every(this._richlistbox.selectedItems,
element => element._shell.isCommandEnabled(aCommand));
return Array.prototype.every.call(
this._richlistbox.selectedItems,
element => element._shell.isCommandEnabled(aCommand));
}
},
_copySelectedDownloadsToClipboard() {
let urls = Array.map(this._richlistbox.selectedItems,
element => element._shell.download.source.url);
let urls = Array.from(this._richlistbox.selectedItems,
element => element._shell.download.source.url);
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)