From fd1966eebb3e1b075d09c2c33f5100570466c83f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 18 Aug 2016 03:48:12 +1000 Subject: [PATCH] Work around Array.concat bug --- common/modules/polyfill.jsm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/modules/polyfill.jsm b/common/modules/polyfill.jsm index 036af0a7..f5dc420a 100644 --- a/common/modules/polyfill.jsm +++ b/common/modules/polyfill.jsm @@ -18,6 +18,7 @@ let identity = x => x; + // < FF47 if (!Object.entries) Object.entries = function (obj) { let result = []; @@ -32,6 +33,7 @@ return result; }; + // < FF47 if (!Object.values) Object.values = function (obj) { let result = []; @@ -46,6 +48,7 @@ return result; }; + // < FFEleventyBillion if (!Array.prototype.flatMap) Array.prototype.flatMap = function (fn = identity, self = null) { let result = []; @@ -68,12 +71,19 @@ return this.indexOf(...args) != -1; }; + // < FF48 if (!Array.prototype.values) Array.prototype.values = function* () { for (let [i, value] of this.entries()) yield value; }; + // > FF47 + // Broken in 48: primitive first arg is wrapped + Array.concat = function (...args) { + return Array.prototype.concat.apply([], args); + } + // < FF40 if (!String.prototype.includes) String.prototype.includes = String.prototype.contains;