@@ -53,12 +53,23 @@ import CallHandler from 'matrix-react-sdk/src/CallHandler';
5353
5454let lastLocationHashSet = null ;
5555
56- function checkBrowserFeatures ( featureList ) {
56+ function checkBrowserFeatures ( ) {
5757 if ( ! window . Modernizr ) {
5858 console . error ( "Cannot check features - Modernizr global is missing." ) ;
5959 return false ;
6060 }
6161
62+ // custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks in it for some features we depend on,
63+ // Modernizr requires rules to be lowercase with no punctuation:
64+ // ES2018: http://www.ecma-international.org/ecma-262/9.0/#sec-promise.prototype.finally
65+ window . Modernizr . addTest ( "promiseprototypefinally" , ( ) =>
66+ window . Promise && window . Promise . prototype && typeof window . Promise . prototype . finally === "function" ) ;
67+ // ES2019: http://www.ecma-international.org/ecma-262/10.0/#sec-object.fromentries
68+ window . Modernizr . addTest ( "objectfromentries" , ( ) =>
69+ window . Object && typeof window . Object . fromEntries === "function" ) ;
70+
71+ const featureList = Object . keys ( window . Modernizr ) ;
72+
6273 let featureComplete = true ;
6374 for ( let i = 0 ; i < featureList . length ; i ++ ) {
6475 if ( window . Modernizr [ featureList [ i ] ] === undefined ) {
@@ -74,19 +85,6 @@ function checkBrowserFeatures(featureList) {
7485 featureComplete = false ;
7586 }
7687 }
77-
78- // custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks in it for some features we depend on:
79- // ES2018: http://www.ecma-international.org/ecma-262/9.0/#sec-promise.prototype.finally
80- if ( ! Promise || ! Promise . prototype || typeof Promise . prototype . finally !== "function" ) {
81- console . error ( "Browser missing feature: Promise.prototype.finally" ) ;
82- featureComplete = false ;
83- }
84- // ES2019: http://www.ecma-international.org/ecma-262/10.0/#sec-object.fromentries
85- if ( ! Object || typeof Object . fromEntries !== "function" ) {
86- console . error ( "Browser missing feature: Object.fromEntries" ) ;
87- featureComplete = false ;
88- }
89-
9088 return featureComplete ;
9189}
9290
@@ -273,10 +271,7 @@ export async function loadApp() {
273271 return ;
274272 }
275273
276- const validBrowser = checkBrowserFeatures ( [
277- "displaytable" , "flexbox" , "es5object" , "es5function" , "localstorage" ,
278- "objectfit" , "indexeddb" , "webworkers" ,
279- ] ) ;
274+ const validBrowser = checkBrowserFeatures ( ) ;
280275
281276 const acceptInvalidBrowser = window . localStorage && window . localStorage . getItem ( 'mx_accepts_unsupported_browser' ) ;
282277
0 commit comments