From 032efafe2e3c4ca2c82fa633dadaabf221fe2d35 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 4 Feb 2020 13:35:05 +0000 Subject: [PATCH] Rejig things around to catch Promises not being a thing at all --- src/vector/app.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/vector/app.js b/src/vector/app.js index b2d9e02c32..2fe4ddff31 100644 --- a/src/vector/app.js +++ b/src/vector/app.js @@ -54,25 +54,12 @@ import CallHandler from 'matrix-react-sdk/src/CallHandler'; let lastLocationHashSet = null; function checkBrowserFeatures(featureList) { - let featureComplete = true; - - // custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks in it for some features we depend on: - // ran prior to Modernizr so the missing features are logged even if Modernizr is broken - // ES2018: http://www.ecma-international.org/ecma-262/9.0/#sec-promise.prototype.finally - if (typeof Promise.prototype.finally !== "function") { - console.error("Browser missing feature: Promise.prototype.finally"); - featureComplete = false; - } - // ES2019: http://www.ecma-international.org/ecma-262/10.0/#sec-object.fromentries - if (typeof Object.fromEntries !== "function") { - console.error("Browser missing feature: Object.fromEntries"); - featureComplete = false; - } - if (!window.Modernizr) { console.error("Cannot check features - Modernizr global is missing."); return false; } + + let featureComplete = true; for (let i = 0; i < featureList.length; i++) { if (window.Modernizr[featureList[i]] === undefined) { console.error( @@ -88,6 +75,18 @@ function checkBrowserFeatures(featureList) { } } + // custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks in it for some features we depend on: + // ES2018: http://www.ecma-international.org/ecma-262/9.0/#sec-promise.prototype.finally + if (!Promise || !Promise.prototype || typeof Promise.prototype.finally !== "function") { + console.error("Browser missing feature: Promise.prototype.finally"); + featureComplete = false; + } + // ES2019: http://www.ecma-international.org/ecma-262/10.0/#sec-object.fromentries + if (!Object || typeof Object.fromEntries !== "function") { + console.error("Browser missing feature: Object.fromEntries"); + featureComplete = false; + } + return featureComplete; }