Bug 1363828 - Replace custom isArray() by Array.isArray() r=chutten
authorflyingrub <flyinggrub@gmail.com>
Fri, 26 May 2017 17:05:18 +0200
changeset 409417 2c9139008c3ce668a7b002e0dd2a40405e5dac41
parent 409416 07f07bc1e39a02f1d9b2e0381ca4935ded3ca13e
child 409418 f50f39148516d431a605816c374498b0b8bfc9e0
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1363828
milestone55.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 1363828 - Replace custom isArray() by Array.isArray() r=chutten MozReview-Commit-ID: 9uErcVbMgLv
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -56,22 +56,18 @@ var documentRTLMode = "";
  * Caches result of check on first invocation.
  */
 function isRTL() {
   if (!documentRTLMode)
     documentRTLMode = window.getComputedStyle(document.body).direction;
   return (documentRTLMode == "rtl");
 }
 
-function isArray(arg) {
-  return Object.prototype.toString.call(arg) === "[object Array]";
-}
-
 function isFlatArray(obj) {
-  if (!isArray(obj)) {
+  if (!Array.isArray(obj)) {
     return false;
   }
   return !obj.some(e => typeof(e) == "object");
 }
 
 /**
  * This is a helper function for explodeObject.
  */
@@ -79,17 +75,17 @@ function flattenObject(obj, map, path, a
   for (let k of Object.keys(obj)) {
     let newPath = [...path, array ? "[" + k + "]" : k];
     let v = obj[k];
     if (!v || (typeof(v) != "object")) {
       map.set(newPath.join("."), v);
     } else if (isFlatArray(v)) {
       map.set(newPath.join("."), "[" + v.join(", ") + "]");
     } else {
-      flattenObject(v, map, newPath, isArray(v));
+      flattenObject(v, map, newPath, Array.isArray(v));
     }
   }
 }
 
 /**
  * This turns a JSON object into a "flat" stringified form.
  *
  * For an object like {a: "1", b: {c: "2", d: "3"}} it returns a Map of the