Bug 1563073 - Quantumbar: Replace deprecated Array.reduce call with a for-loop. r=dao
authorDrew Willcoxon <adw@mozilla.com>
Wed, 03 Jul 2019 10:48:49 +0000
changeset 543966 4c69924a938cf8f8b22497ec4c8cca3c2f56fc18
parent 543965 e55273098f972c19f88b458cd56ff1a8cb5001dd
child 543967 90e386cbfa6abcfd9d296c16798009d536376368
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1563073
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1563073 - Quantumbar: Replace deprecated Array.reduce call with a for-loop. r=dao Just use a for-loop instead of the ugly `Array.prototype.reduce.call()` or unnecessarily creating an array with `Array.from(this._rows.children).reduce()`. Differential Revision: https://phabricator.services.mozilla.com/D36689
browser/components/urlbar/UrlbarView.jsm
--- a/browser/components/urlbar/UrlbarView.jsm
+++ b/browser/components/urlbar/UrlbarView.jsm
@@ -115,19 +115,21 @@ class UrlbarView {
 
   /**
    * @returns {number}
    *   The number of visible results in the view.  Note that this may be larger
    *   than the number of results in the current query context since the view
    *   may be showing stale results.
    */
   get visibleItemCount() {
-    return Array.reduce(this._rows.children, (sum, r) => {
-      return sum + Number(this._isRowVisible(r));
-    }, 0);
+    let sum = 0;
+    for (let row of this._rows.children) {
+      sum += Number(this._isRowVisible(row));
+    }
+    return sum;
   }
 
   /**
    * Moves the view selection forward or backward.
    *
    * @param {number} amount
    *   The number of steps to move.
    * @param {boolean} options.reverse