startup: Drop JavaScript support for ES3-only browsers

Bug: T128115
Change-Id: I95400637d1b85d2c607cd91bcb39ce21733295c8
This commit is contained in:
James D. Forrester 2017-03-02 13:54:19 -08:00 committed by Timo Tijhof
parent 888ae46bc3
commit 09fcee6110
8 changed files with 29 additions and 2164 deletions

View file

@ -281,6 +281,8 @@ changes to languages because of Phabricator reports.
rather than <strong> tags. The old class name, "selflink", was deprecated
and will be removed in a future release. (T160480)
* (T156184) $wgRawHtml will no longer apply to internationalization messages.
* Browser support for non-ES5 JavaScript browsers, including Android 2, Opera 12,
and Internet Explorer 9, was lowered from Grade A to Grade C.
== Compatibility ==

View file

@ -715,8 +715,6 @@ return [
],
/* json2 */
// Deprecated since MediaWiki 1.29.0
'json' => [
'deprecated' => 'Use of the "json" module is deprecated since MediaWiki 1.29.0',
'targets' => [ 'desktop', 'mobile' ],
@ -2454,18 +2452,14 @@ return [
'oojs-ui-core',
],
],
/* es5-shim */
'es5-shim' => [
'scripts' => [
'resources/lib/es5-shim/es5-shim.js',
'resources/src/polyfill-object-create.js',
],
'deprecated' => 'Use of the "es5-shim" module is deprecated since MediaWiki 1.29.0',
'targets' => [ 'desktop', 'mobile' ],
'skipFunction' => 'resources/src/es5-skip.js',
],
/* dom-level2-shim */
// Deprecated since MediaWiki 1.29.0
'dom-level2-shim' => [
'deprecated' => 'Use of the "dom-level2-shim" module is deprecated since MediaWiki 1.29.0',
'targets' => [ 'desktop', 'mobile' ],
@ -2478,9 +2472,6 @@ return [
'resources/src/oojs-global.js',
],
'targets' => [ 'desktop', 'mobile' ],
'dependencies' => [
'es5-shim',
],
],
'mediawiki.router' => [

View file

@ -65,7 +65,6 @@ return call_user_func( function () {
],
'skinScripts' => $getSkinSpecific( null, 'js' ),
'dependencies' => [
'es5-shim',
'oojs',
'oojs-ui-core.styles',
'oojs-ui.styles.icons',

File diff suppressed because it is too large Load diff

View file

@ -1,18 +0,0 @@
/*!
* Skip function for es5-shim module.
*
* Test for strict mode as a proxy for full ES5 function support (but not syntax)
* Per http://kangax.github.io/compat-table/es5/ this is a reasonable shortcut
* that still allows this to be as short as possible (there are no browsers we
* support that have strict mode, but lack other features).
*
* Do explicitly test for Function#bind because of PhantomJS (which implements
* strict mode, but lacks Function#bind).
*
* IE9 supports all features except strict mode, so loading es5-shim should be close to
* a no-op but does increase page payload).
*/
return ( function () {
'use strict';
return !this && !!Function.prototype.bind;
}() );

View file

@ -1,62 +0,0 @@
/**
* Simplified version of es5-sham#Object-create that also works around a bug
* in the actual es5-sham: https://github.com/es-shims/es5-shim/issues/252
*
* Does not:
* - Support empty inheritance via `Object.create(null)`.
* - Support getter and setter accessors via `Object.create( .., properties )`.
* - Support custom property descriptor (e.g. writable, configurtable, enumerable).
* - Leave behind an enumerable "__proto__" all over the place.
*
* @author Timo Tijhof, 2014
*/
// ES5 15.2.3.5
// http://es5.github.com/#x15.2.3.5
if ( !Object.create ) {
( function () {
var hasOwn = Object.hasOwnProperty,
// https://developer.mozilla.org/en-US/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
isEnumBug = !{ valueOf: 0 }.propertyIsEnumerable( 'valueOf' );
// Reusable constructor function for Object.create
function Empty() {}
function defineProperty( object, key, property ) {
if ( hasOwn.call( property, 'value' ) ) {
object[ key ] = property.value;
} else {
object[ key ] = property;
}
}
Object.create = function create( prototype, properties ) {
var object, key;
if ( prototype !== Object( prototype ) ) {
throw new TypeError( 'Called on non-object' );
}
Empty.prototype = prototype;
object = new Empty();
if ( properties !== undefined ) {
if ( !isEnumBug ) {
for ( key in properties ) {
if ( hasOwn.call( properties, key ) ) {
defineProperty( object, key, properties[ key ] );
}
}
} else {
Object.keys( properties ).forEach( function ( key ) {
defineProperty( object, key, properties[ key ] );
} );
}
}
return object;
};
}() );
}

View file

@ -26,19 +26,19 @@ mwPerformance.mark( 'mwLoadStart' );
* See <https://www.mediawiki.org/wiki/Compatibility#Browsers>
*
* Capabilities required for modern run-time:
* - ECMAScript 5
* - DOM Level 4 & Selectors API Level 1
* - HTML5 & Web Storage
* - DOM Level 2 Events
* - JSON
*
* Browsers we support in our modern run-time (Grade A):
* - Chrome 4+
* - IE 9+
* - Firefox 3.5+
* - Chrome 13+
* - IE 10+
* - Firefox 4+
* - Safari 5+
* - Opera 10.5+
* - Mobile Safari (iOS 4+)
* - Android 2.0+
* - Opera 15+
* - Mobile Safari 5.1+ (iOS 5+)
* - Android 4.1+
*
* Browsers we support in our no-javascript run-time (Grade C):
* - Chrome 1+
@ -46,6 +46,8 @@ mwPerformance.mark( 'mwLoadStart' );
* - Firefox 3+
* - Safari 3+
* - Opera 10+
* - Mobile Safari 5.0+ (iOS 4+)
* - Android 2.0+
* - WebOS < 1.5
* - PlayStation
* - Symbian-based browsers
@ -64,6 +66,14 @@ mwPerformance.mark( 'mwLoadStart' );
function isCompatible( str ) {
var ua = str || navigator.userAgent;
return !!(
// http://caniuse.com/#feat=es5
// http://caniuse.com/#feat=use-strict
// http://caniuse.com/#feat=json / https://phabricator.wikimedia.org/T141344#2784065
( function () {
'use strict';
return !this && !!Function.prototype.bind && !!window.JSON;
}() ) &&
// http://caniuse.com/#feat=queryselector
'querySelector' in document &&
@ -75,10 +85,6 @@ function isCompatible( str ) {
// http://caniuse.com/#feat=addeventlistener
'addEventListener' in window &&
// http://caniuse.com/#feat=json
// https://phabricator.wikimedia.org/T141344#2784065
( window.JSON && JSON.stringify && JSON.parse ) &&
// 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

View file

@ -17,15 +17,11 @@
'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Safari/533.1',
// Safari 5.0+
'Mozilla/5.0 (Macintosh; I; Intel Mac OS X 10_6_7; ru-ru) AppleWebKit/534.31+ (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1',
// Opera 12+ (Presto-based)
'Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00',
'Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.17',
// Opera 15+ (Chromium-based)
'Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 OPR/15.0.1147.153',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36 OPR/16.0.1196.62',
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 OPR/23.0.1522.75',
// Internet Explorer 9+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)',
// Internet Explorer 10+
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
// IE Mobile
@ -52,7 +48,7 @@
/* Grade C */
// Internet Explorer < 9
// Internet Explorer < 10
'Mozilla/2.0 (compatible; MSIE 3.03; Windows 3.1)',
'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)',
'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98;)',
@ -60,10 +56,12 @@
'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; en-US)',
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)',
// Firefox < 3
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)',
// Firefox < 4
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2',
'Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.8.1.1) Gecko/20070311 Firefox/2.0.0.1',
// Opera < 12
'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',
// Opera < 15 (Presto-based)
'Mozilla/5.0 (Windows NT 5.0; U) Opera 7.54 [en]',
'Opera/7.54 (Windows NT 5.0; U) [en]',
'Mozilla/5.0 (Windows NT 5.1; U; en) Opera 8.0',
@ -73,14 +71,14 @@
'Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.00',
'Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.8.131 Version/11.10',
'Opera/9.80 (Windows NT 6.1; WOW64; U; pt) Presto/2.10.229 Version/11.62',
'Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00',
'Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.17',
// BlackBerry < 6
'BlackBerry9300/5.0.0.716 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/133',
'BlackBerry7250/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1',
/* Grade X */
// Firefox 3.6
'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',
// Gecko
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060928 (Debian|Debian-1.8.0.7-1) Epiphany/2.14',
'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.6) Gecko/20070817 IceWeasel/2.0.0.6-g2',