X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fstartup%2Fstartup.js;h=f2d964a1c19469a8d4c75adfa41cea3ac7338eca;hb=8c2eb40f59e3514fcecb7c4e4a5cf79c4eae8ba8;hp=bebf4dcf4aabf17f14c93c14976a72c432d9668f;hpb=00063e1eb126d6a0917331d46303d7ea180c74bc;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/startup/startup.js b/resources/src/startup/startup.js index bebf4dcf4a..f2d964a1c1 100644 --- a/resources/src/startup/startup.js +++ b/resources/src/startup/startup.js @@ -44,11 +44,11 @@ * * Other browsers that pass the check are considered Grade X. * - * @param {string} [str] User agent, defaults to navigator.userAgent + * @private + * @param {string} ua User agent string * @return {boolean} User agent is compatible with MediaWiki JS */ -function isCompatible( str ) { - var ua = str || navigator.userAgent; +function isCompatible( ua ) { return !!( // https://caniuse.com/#feat=es5 // https://caniuse.com/#feat=use-strict @@ -69,14 +69,16 @@ function isCompatible( str ) { // https://caniuse.com/#feat=addeventlistener 'addEventListener' in window && - // Hardcoded exceptions for browsers that pass the requirement but we don't want to - // support in the modern run-time. - // Note: Please extend the regex instead of adding new ones + // Hardcoded exceptions for browsers that pass the requirement but we don't + // want to support in the modern run-time. + // + // Please extend the regex instead of adding new ones! + // And add a test case to startup.test.js !ua.match( /MSIE 10|webOS\/1\.[0-4]|SymbianOS|Series60|NetFront|Opera Mini|S40OviBrowser|MeeGo|Android.+Glass|^Mozilla\/5\.0 .+ Gecko\/$|googleweblight|PLAYSTATION|PlayStation/ ) ); } -if ( !isCompatible() ) { +if ( !isCompatible( navigator.userAgent ) ) { // Handle Grade C // Undo speculative Grade A class. See ResourceLoaderClientHtml::getDocumentAttributes(). document.documentElement.className = document.documentElement.className