@@ -53,11 +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 }
61+
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+
6173 let featureComplete = true ;
6274 for ( let i = 0 ; i < featureList . length ; i ++ ) {
6375 if ( window . Modernizr [ featureList [ i ] ] === undefined ) {
@@ -69,8 +81,7 @@ function checkBrowserFeatures(featureList) {
6981 }
7082 if ( window . Modernizr [ featureList [ i ] ] === false ) {
7183 console . error ( "Browser missing feature: '%s'" , featureList [ i ] ) ;
72- // toggle flag rather than return early so we log all missing features
73- // rather than just the first.
84+ // toggle flag rather than return early so we log all missing features rather than just the first.
7485 featureComplete = false ;
7586 }
7687 }
@@ -260,10 +271,7 @@ export async function loadApp() {
260271 return ;
261272 }
262273
263- const validBrowser = checkBrowserFeatures ( [
264- "displaytable" , "flexbox" , "es5object" , "es5function" , "localstorage" ,
265- "objectfit" , "indexeddb" , "webworkers" ,
266- ] ) ;
274+ const validBrowser = checkBrowserFeatures ( ) ;
267275
268276 const acceptInvalidBrowser = window . localStorage && window . localStorage . getItem ( 'mx_accepts_unsupported_browser' ) ;
269277
0 commit comments