Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/224052

Change subject: Update es5-shim to 4.1.8
......................................................................

Update es5-shim to 4.1.8

Project link

* https://github.com/es-shims/es5-shim

File link

* https://github.com/es-shims/es5-shim/blob/v4.1.8/es5-shim.js

Changelog

4.1.8

* https://github.com/es-shims/es5-shim/releases/tag/v4.1.8

Change-Id: Ife16acddc2131c1054392db9bc14385ccc37c38b
---
M .rubocop.yml
M resources/lib/es5-shim/es5-shim.js
M tests/browser/features/step_definitions/create_account_steps.rb
3 files changed, 276 insertions(+), 164 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/52/224052/1

diff --git a/.rubocop.yml b/.rubocop.yml
index 61ffc1a..5b6c3f2 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,6 +1,7 @@
 AllCops:
   Exclude:
     - 'extensions/**/*'
+    - 'node_modules/**/*'
     - 'skins/**/*'
     - 'tests/frontend/node_modules/**/*'
     - 'vendor/**/*'
diff --git a/resources/lib/es5-shim/es5-shim.js 
b/resources/lib/es5-shim/es5-shim.js
index 85f51e2..2cc0762 100644
--- a/resources/lib/es5-shim/es5-shim.js
+++ b/resources/lib/es5-shim/es5-shim.js
@@ -14,7 +14,7 @@
 (function (root, factory) {
     'use strict';
 
-    /*global define, exports, module */
+    /* global define, exports, module */
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
         define(factory);
@@ -39,51 +39,40 @@
  */
 
 // Shortcut to an often accessed properties, in order to avoid multiple
-// dereference that costs universally.
-var ArrayPrototype = Array.prototype;
-var ObjectPrototype = Object.prototype;
+// dereference that costs universally. This also holds a reference to 
known-good
+// functions.
+var $Array = Array;
+var ArrayPrototype = $Array.prototype;
+var $Object = Object;
+var ObjectPrototype = $Object.prototype;
 var FunctionPrototype = Function.prototype;
-var StringPrototype = String.prototype;
-var NumberPrototype = Number.prototype;
+var $String = String;
+var StringPrototype = $String.prototype;
+var $Number = Number;
+var NumberPrototype = $Number.prototype;
 var array_slice = ArrayPrototype.slice;
 var array_splice = ArrayPrototype.splice;
 var array_push = ArrayPrototype.push;
 var array_unshift = ArrayPrototype.unshift;
 var array_concat = ArrayPrototype.concat;
 var call = FunctionPrototype.call;
+var max = Math.max;
+var min = Math.min;
 
 // Having a toString local variable name breaks in Opera so use to_string.
 var to_string = ObjectPrototype.toString;
-
-var isArray = Array.isArray || function isArray(obj) {
-    return to_string.call(obj) === '[object Array]';
-};
 
 var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag 
=== 'symbol';
 var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = 
Function.prototype.toString, tryFunctionObject = function 
tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) 
{ return false; } }, fnClass = '[object Function]', genClass = '[object 
GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value 
!== 'function') { return false; } if (hasToStringTag) { return 
tryFunctionObject(value); } var strClass = to_string.call(value); return 
strClass === fnClass || strClass === genClass; };
 var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = 
RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { 
regexExec.call(value); return true; } catch (e) { return false; } }, regexClass 
= '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 
'object') { return false; } return hasToStringTag ? tryRegexExec(value) : 
to_string.call(value) === regexClass; };
 var isString; /* inlined from https://npmjs.com/is-string */ var strValue = 
String.prototype.valueOf, tryStringObject = function tryStringObject(value) { 
try { strValue.call(value); return true; } catch (e) { return false; } }, 
stringClass = '[object String]'; isString = function isString(value) { if 
(typeof value === 'string') { return true; } if (typeof value !== 'object') { 
return false; } return hasToStringTag ? tryStringObject(value) : 
to_string.call(value) === stringClass; };
 
-var isArguments = function isArguments(value) {
-    var str = to_string.call(value);
-    var isArgs = str === '[object Arguments]';
-    if (!isArgs) {
-        isArgs = !isArray(value) &&
-          value !== null &&
-          typeof value === 'object' &&
-          typeof value.length === 'number' &&
-          value.length >= 0 &&
-          isCallable(value.callee);
-    }
-    return isArgs;
-};
-
 /* inlined from http://npmjs.com/define-properties */
 var defineProperties = (function (has) {
-  var supportsDescriptors = Object.defineProperty && (function () {
+  var supportsDescriptors = $Object.defineProperty && (function () {
       try {
           var obj = {};
-          Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
+          $Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
           for (var _ in obj) { return false; }
           return obj.x === obj;
       } catch (e) { /* this is ES3 */
@@ -97,7 +86,7 @@
   if (supportsDescriptors) {
       defineProperty = function (object, name, method, forceAssign) {
           if (!forceAssign && (name in object)) { return; }
-          Object.defineProperty(object, name, {
+          $Object.defineProperty(object, name, {
               configurable: true,
               enumerable: false,
               writable: true,
@@ -172,11 +161,11 @@
     // http://es5.github.com/#x9.9
     /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */
     ToObject: function (o) {
-        /*jshint eqnull: true */
+        /* jshint eqnull: true */
         if (o == null) { // this matches both null and undefined
             throw new TypeError("can't convert " + o + ' to object');
         }
-        return Object(o);
+        return $Object(o);
     },
 
     /* replaceable with https://npmjs.com/package/es-abstract ES5.ToUint32 */
@@ -240,7 +229,7 @@
                     this,
                     array_concat.call(args, array_slice.call(arguments))
                 );
-                if (Object(result) === result) {
+                if ($Object(result) === result) {
                     return result;
                 }
                 return this;
@@ -280,13 +269,13 @@
         //       larger.
         // 16. Else set the length own property of F to 0.
 
-        var boundLength = Math.max(0, target.length - args.length);
+        var boundLength = max(0, target.length - args.length);
 
         // 17. Set the attributes of the length own property of F to the values
         //   specified in 15.3.5.1.
         var boundArgs = [];
         for (var i = 0; i < boundLength; i++) {
-            boundArgs.push('$' + i);
+            array_push.call(boundArgs, '$' + i);
         }
 
         // XXX Build a dynamic function with desired amount of arguments is 
the only
@@ -332,51 +321,18 @@
 // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
 // us it in defining shortcuts.
 var owns = call.bind(ObjectPrototype.hasOwnProperty);
+var toStr = call.bind(ObjectPrototype.toString);
+var strSlice = call.bind(StringPrototype.slice);
+var strSplit = call.bind(StringPrototype.split);
 
 //
 // Array
 // =====
 //
 
-// ES5 15.4.4.12
-// http://es5.github.com/#x15.4.4.12
-var spliceNoopReturnsEmptyArray = (function () {
-    var a = [1, 2];
-    var result = a.splice();
-    return a.length === 2 && isArray(result) && result.length === 0;
-}());
-defineProperties(ArrayPrototype, {
-    // Safari 5.0 bug where .splice() returns undefined
-    splice: function splice(start, deleteCount) {
-        if (arguments.length === 0) {
-            return [];
-        } else {
-            return array_splice.apply(this, arguments);
-        }
-    }
-}, !spliceNoopReturnsEmptyArray);
-
-var spliceWorksWithEmptyObject = (function () {
-    var obj = {};
-    ArrayPrototype.splice.call(obj, 0, 0, 1);
-    return obj.length === 1;
-}());
-defineProperties(ArrayPrototype, {
-    splice: function splice(start, deleteCount) {
-        if (arguments.length === 0) { return []; }
-        var args = arguments;
-        this.length = Math.max(ES.ToInteger(this.length), 0);
-        if (arguments.length > 0 && typeof deleteCount !== 'number') {
-            args = array_slice.call(arguments);
-            if (args.length < 2) {
-                args.push(this.length - start);
-            } else {
-                args[1] = ES.ToInteger(deleteCount);
-            }
-        }
-        return array_splice.apply(this, args);
-    }
-}, !spliceWorksWithEmptyObject);
+var isArray = $Array.isArray || function isArray(obj) {
+    return toStr(obj) === '[object Array]';
+};
 
 // ES5 15.4.4.12
 // http://es5.github.com/#x15.4.4.13
@@ -394,7 +350,7 @@
 // ES5 15.4.3.2
 // http://es5.github.com/#x15.4.3.2
 // 
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
-defineProperties(Array, { isArray: isArray });
+defineProperties($Array, { isArray: isArray });
 
 // The IsCallable() check in the Array functions
 // has been replaced with a strict check on the
@@ -414,7 +370,7 @@
 
 // Check failure of by-index access of string characters (IE < 9)
 // and failure of `0 in boxedString` (Rhino)
-var boxedString = Object('a');
+var boxedString = $Object('a');
 var splitString = boxedString[0] !== 'a' || !(0 in boxedString);
 
 var properlyBoxesContext = function properlyBoxed(method) {
@@ -438,7 +394,7 @@
 defineProperties(ArrayPrototype, {
     forEach: function forEach(callbackfn /*, thisArg*/) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var i = -1;
         var length = self.length >>> 0;
         var T;
@@ -471,9 +427,9 @@
 defineProperties(ArrayPrototype, {
     map: function map(callbackfn/*, thisArg*/) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var length = self.length >>> 0;
-        var result = Array(length);
+        var result = $Array(length);
         var T;
         if (arguments.length > 1) {
             T = arguments[1];
@@ -503,7 +459,7 @@
 defineProperties(ArrayPrototype, {
     filter: function filter(callbackfn /*, thisArg*/) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var length = self.length >>> 0;
         var result = [];
         var value;
@@ -521,7 +477,7 @@
             if (i in self) {
                 value = self[i];
                 if (typeof T === 'undefined' ? callbackfn(value, i, object) : 
callbackfn.call(T, value, i, object)) {
-                    result.push(value);
+                    array_push.call(result, value);
                 }
             }
         }
@@ -535,7 +491,7 @@
 defineProperties(ArrayPrototype, {
     every: function every(callbackfn /*, thisArg*/) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var length = self.length >>> 0;
         var T;
         if (arguments.length > 1) {
@@ -562,7 +518,7 @@
 defineProperties(ArrayPrototype, {
     some: function some(callbackfn/*, thisArg */) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var length = self.length >>> 0;
         var T;
         if (arguments.length > 1) {
@@ -593,7 +549,7 @@
 defineProperties(ArrayPrototype, {
     reduce: function reduce(callbackfn /*, initialValue*/) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var length = self.length >>> 0;
 
         // If no callback function or if callback is not a callable function
@@ -644,7 +600,7 @@
 defineProperties(ArrayPrototype, {
     reduceRight: function reduceRight(callbackfn/*, initial*/) {
         var object = ES.ToObject(this);
-        var self = splitString && isString(this) ? this.split('') : object;
+        var self = splitString && isString(this) ? strSplit(this, '') : object;
         var length = self.length >>> 0;
 
         // If no callback function or if callback is not a callable function
@@ -692,10 +648,10 @@
 // ES5 15.4.4.14
 // http://es5.github.com/#x15.4.4.14
 // 
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
-var hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) 
!== -1;
+var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== 
-1;
 defineProperties(ArrayPrototype, {
     indexOf: function indexOf(searchElement /*, fromIndex */) {
-        var self = splitString && isString(this) ? this.split('') : 
ES.ToObject(this);
+        var self = splitString && isString(this) ? strSplit(this, '') : 
ES.ToObject(this);
         var length = self.length >>> 0;
 
         if (length === 0) {
@@ -708,7 +664,7 @@
         }
 
         // handle negative indices
-        i = i >= 0 ? i : Math.max(0, length + i);
+        i = i >= 0 ? i : max(0, length + i);
         for (; i < length; i++) {
             if (i in self && self[i] === searchElement) {
                 return i;
@@ -721,10 +677,10 @@
 // ES5 15.4.4.15
 // http://es5.github.com/#x15.4.4.15
 // 
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
-var hasFirefox2LastIndexOfBug = Array.prototype.lastIndexOf && [0, 
1].lastIndexOf(0, -3) !== -1;
+var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 
1].lastIndexOf(0, -3) !== -1;
 defineProperties(ArrayPrototype, {
     lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */) {
-        var self = splitString && isString(this) ? this.split('') : 
ES.ToObject(this);
+        var self = splitString && isString(this) ? strSplit(this, '') : 
ES.ToObject(this);
         var length = self.length >>> 0;
 
         if (length === 0) {
@@ -732,7 +688,7 @@
         }
         var i = length - 1;
         if (arguments.length > 1) {
-            i = Math.min(i, ES.ToInteger(arguments[1]));
+            i = min(i, ES.ToInteger(arguments[1]));
         }
         // handle negative indices
         i = i >= 0 ? i : length - Math.abs(i);
@@ -745,6 +701,128 @@
     }
 }, hasFirefox2LastIndexOfBug);
 
+// ES5 15.4.4.12
+// http://es5.github.com/#x15.4.4.12
+var spliceNoopReturnsEmptyArray = (function () {
+    var a = [1, 2];
+    var result = a.splice();
+    return a.length === 2 && isArray(result) && result.length === 0;
+}());
+defineProperties(ArrayPrototype, {
+    // Safari 5.0 bug where .splice() returns undefined
+    splice: function splice(start, deleteCount) {
+        if (arguments.length === 0) {
+            return [];
+        } else {
+            return array_splice.apply(this, arguments);
+        }
+    }
+}, !spliceNoopReturnsEmptyArray);
+
+var spliceWorksWithEmptyObject = (function () {
+    var obj = {};
+    ArrayPrototype.splice.call(obj, 0, 0, 1);
+    return obj.length === 1;
+}());
+defineProperties(ArrayPrototype, {
+    splice: function splice(start, deleteCount) {
+        if (arguments.length === 0) { return []; }
+        var args = arguments;
+        this.length = max(ES.ToInteger(this.length), 0);
+        if (arguments.length > 0 && typeof deleteCount !== 'number') {
+            args = array_slice.call(arguments);
+            if (args.length < 2) {
+                array_push.call(args, this.length - start);
+            } else {
+                args[1] = ES.ToInteger(deleteCount);
+            }
+        }
+        return array_splice.apply(this, args);
+    }
+}, !spliceWorksWithEmptyObject);
+var spliceWorksWithLargeSparseArrays = (function () {
+    // Per https://github.com/es-shims/es5-shim/issues/295
+    // Safari 7/8 breaks with sparse arrays of size 1e5 or greater
+    var arr = new $Array(1e5);
+    // note: the index MUST be 8 or larger or the test will false pass
+    arr[8] = 'x';
+    arr.splice(1, 1);
+    // note: this test must be defined *after* the indexOf shim
+    // per https://github.com/es-shims/es5-shim/issues/313
+    return arr.indexOf('x') === 7;
+}());
+var spliceWorksWithSmallSparseArrays = (function () {
+    // Per https://github.com/es-shims/es5-shim/issues/295
+    // Opera 12.15 breaks on this, no idea why.
+    var n = 256;
+    var arr = [];
+    arr[n] = 'a';
+    arr.splice(n + 1, 0, 'b');
+    return arr[n] === 'a';
+}());
+defineProperties(ArrayPrototype, {
+    splice: function splice(start, deleteCount) {
+        var O = ES.ToObject(this);
+        var A = [];
+        var len = ES.ToUint32(O.length);
+        var relativeStart = ES.ToInteger(start);
+        var actualStart = relativeStart < 0 ? max((len + relativeStart), 0) : 
min(relativeStart, len);
+        var actualDeleteCount = min(max(ES.ToInteger(deleteCount), 0), len - 
actualStart);
+
+        var k = 0;
+        var from;
+        while (k < actualDeleteCount) {
+            from = $String(actualStart + k);
+            if (owns(O, from)) {
+                A[k] = O[from];
+            }
+            k += 1;
+        }
+
+        var items = array_slice.call(arguments, 2);
+        var itemCount = items.length;
+        var to;
+        if (itemCount < actualDeleteCount) {
+            k = actualStart;
+            while (k < (len - actualDeleteCount)) {
+                from = $String(k + actualDeleteCount);
+                to = $String(k + itemCount);
+                if (owns(O, from)) {
+                    O[to] = O[from];
+                } else {
+                    delete O[to];
+                }
+                k += 1;
+            }
+            k = len;
+            while (k > (len - actualDeleteCount + itemCount)) {
+                delete O[k - 1];
+                k -= 1;
+            }
+        } else if (itemCount > actualDeleteCount) {
+            k = len - actualDeleteCount;
+            while (k > actualStart) {
+                from = $String(k + actualDeleteCount - 1);
+                to = $String(k + itemCount - 1);
+                if (owns(O, from)) {
+                    O[to] = O[from];
+                } else {
+                    delete O[to];
+                }
+                k -= 1;
+            }
+        }
+        k = actualStart;
+        for (var i = 0; i < items.length; ++i) {
+            O[k] = items[i];
+            k += 1;
+        }
+        O.length = len - actualDeleteCount + itemCount;
+
+        return A;
+    }
+}, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays);
+
 //
 // Object
 // ======
@@ -754,26 +832,59 @@
 // http://es5.github.com/#x15.2.3.14
 
 // 
http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
-var hasDontEnumBug = !({ 'toString': null }).propertyIsEnumerable('toString'),
-    hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype'),
-    hasStringEnumBug = !owns('x', '0'),
-    dontEnums = [
-        'toString',
-        'toLocaleString',
-        'valueOf',
-        'hasOwnProperty',
-        'isPrototypeOf',
-        'propertyIsEnumerable',
-        'constructor'
-    ],
-    dontEnumsLength = dontEnums.length;
+var hasDontEnumBug = !({ 'toString': null }).propertyIsEnumerable('toString');
+var hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype');
+var hasStringEnumBug = !owns('x', '0');
+var equalsConstructorPrototype = function (o) {
+    var ctor = o.constructor;
+    return ctor && ctor.prototype === o;
+};
+var blacklistedKeys = ['window', 'console', 'parent', 'self', 'frames'];
+var hasAutomationEqualityBug = (function () {
+    /* globals window */
+    if (typeof window === 'undefined') { return false; }
+    for (var k in window) {
+        if (blacklistedKeys.indexOf(k) === -1 && owns(window, k) && window[k] 
!== null && typeof window[k] === 'object') {
+            try {
+                equalsConstructorPrototype(window[k]);
+            } catch (e) {
+                return true;
+            }
+        }
+    }
+    return false;
+}());
+var dontEnums = [
+    'toString',
+    'toLocaleString',
+    'valueOf',
+    'hasOwnProperty',
+    'isPrototypeOf',
+    'propertyIsEnumerable',
+    'constructor'
+];
+var dontEnumsLength = dontEnums.length;
 
-defineProperties(Object, {
+var isArguments = function isArguments(value) {
+    var str = toStr(value);
+    var isArgs = str === '[object Arguments]';
+    if (!isArgs) {
+        isArgs = !isArray(value) &&
+          value !== null &&
+          typeof value === 'object' &&
+          typeof value.length === 'number' &&
+          value.length >= 0 &&
+          isCallable(value.callee);
+    }
+    return isArgs;
+};
+
+defineProperties($Object, {
     keys: function keys(object) {
-        var isFn = isCallable(object),
-            isArgs = isArguments(object),
-            isObject = object !== null && typeof object === 'object',
-            isStr = isObject && isString(object);
+        var isFn = isCallable(object);
+        var isArgs = isArguments(object);
+        var isObject = object !== null && typeof object === 'object';
+        var isStr = isObject && isString(object);
 
         if (!isObject && !isFn && !isArgs) {
             throw new TypeError('Object.keys called on a non-object');
@@ -783,25 +894,24 @@
         var skipProto = hasProtoEnumBug && isFn;
         if ((isStr && hasStringEnumBug) || isArgs) {
             for (var i = 0; i < object.length; ++i) {
-                theKeys.push(String(i));
+                array_push.call(theKeys, $String(i));
             }
         }
 
         if (!isArgs) {
             for (var name in object) {
                 if (!(skipProto && name === 'prototype') && owns(object, 
name)) {
-                    theKeys.push(String(name));
+                    array_push.call(theKeys, $String(name));
                 }
             }
         }
 
         if (hasDontEnumBug) {
-            var ctor = object.constructor,
-                skipConstructor = ctor && ctor.prototype === object;
+            var skipConstructor = hasAutomationEqualityBug || 
equalsConstructorPrototype(object);
             for (var j = 0; j < dontEnumsLength; j++) {
                 var dontEnum = dontEnums[j];
                 if (!(skipConstructor && dontEnum === 'constructor') && 
owns(object, dontEnum)) {
-                    theKeys.push(dontEnum);
+                    array_push.call(theKeys, dontEnum);
                 }
             }
         }
@@ -809,15 +919,15 @@
     }
 });
 
-var keysWorksWithArguments = Object.keys && (function () {
+var keysWorksWithArguments = $Object.keys && (function () {
     // Safari 5.0 bug
-    return Object.keys(arguments).length === 2;
+    return $Object.keys(arguments).length === 2;
 }(1, 2));
-var originalKeys = Object.keys;
-defineProperties(Object, {
+var originalKeys = $Object.keys;
+defineProperties($Object, {
     keys: function keys(object) {
         if (isArguments(object)) {
-            return originalKeys(ArrayPrototype.slice.call(object));
+            return originalKeys(array_slice.call(object));
         } else {
             return originalKeys(object);
         }
@@ -839,6 +949,7 @@
 var negativeDate = -62198755200000;
 var negativeYearString = '-000001';
 var hasNegativeDateBug = Date.prototype.toISOString && new 
Date(negativeDate).toISOString().indexOf(negativeYearString) === -1;
+var hasSafari51DateBug = Date.prototype.toISOString && new 
Date(-1).toISOString() !== '1969-12-31T23:59:59.999Z';
 
 defineProperties(Date.prototype, {
     toISOString: function toISOString() {
@@ -858,7 +969,7 @@
         result = [month + 1, this.getUTCDate(), this.getUTCHours(), 
this.getUTCMinutes(), this.getUTCSeconds()];
         year = (
             (year < 0 ? '-' : (year > 9999 ? '+' : '')) +
-            ('00000' + Math.abs(year)).slice((0 <= year && year <= 9999) ? -4 
: -6)
+            strSlice('00000' + Math.abs(year), (0 <= year && year <= 9999) ? 
-4 : -6)
         );
 
         length = result.length;
@@ -872,12 +983,12 @@
         }
         // pad milliseconds to have three digits.
         return (
-            year + '-' + result.slice(0, 2).join('-') +
-            'T' + result.slice(2).join(':') + '.' +
-            ('000' + this.getUTCMilliseconds()).slice(-3) + 'Z'
+            year + '-' + array_slice.call(result, 0, 2).join('-') +
+            'T' + array_slice.call(result, 2).join(':') + '.' +
+            strSlice('000' + this.getUTCMilliseconds(), -3) + 'Z'
         );
     }
-}, hasNegativeDateBug);
+}, hasNegativeDateBug || hasSafari51DateBug);
 
 // ES5 15.9.5.44
 // http://es5.github.com/#x15.9.5.44
@@ -903,7 +1014,7 @@
         // 1.  Let O be the result of calling ToObject, giving it the this
         // value as its argument.
         // 2. Let tv be ES.ToPrimitive(O, hint Number).
-        var O = Object(this);
+        var O = $Object(this);
         var tv = ES.ToPrimitive(O);
         // 3. If tv is a Number and is not finite, return null.
         if (typeof tv === 'number' && !isFinite(tv)) {
@@ -941,16 +1052,16 @@
 if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || 
!supportsExtendedYears) {
     // XXX global assignment won't work in embeddings that use
     // an alternate object for the context.
-    /*global Date: true */
-    /*eslint-disable no-undef*/
+    /* global Date: true */
+    /* eslint-disable no-undef */
     Date = (function (NativeDate) {
-    /*eslint-enable no-undef*/
+    /* eslint-enable no-undef */
         // Date.length === 7
         var DateShim = function Date(Y, M, D, h, m, s, ms) {
             var length = arguments.length;
             var date;
             if (this instanceof NativeDate) {
-                date = length === 1 && String(Y) === Y ? // isString(Y)
+                date = length === 1 && $String(Y) === Y ? // isString(Y)
                     // We explicitly pass it through parse:
                     new NativeDate(DateShim.parse(Y)) :
                     // We have to manually make calls depending on argument
@@ -1008,7 +1119,7 @@
         };
 
         var toUTC = function toUTC(t) {
-            return Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
+            return $Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
         };
 
         // Copy any custom methods a 3rd party library may have added
@@ -1029,26 +1140,26 @@
         }, true);
 
         // Upgrade Date.parse to handle simplified ISO 8601 strings
-        DateShim.parse = function parse(string) {
+        var parseShim = function parse(string) {
             var match = isoDateExpression.exec(string);
             if (match) {
                 // parse months, days, hours, minutes, seconds, and 
milliseconds
                 // provide default values if necessary
                 // parse the UTC offset component
-                var year = Number(match[1]),
-                    month = Number(match[2] || 1) - 1,
-                    day = Number(match[3] || 1) - 1,
-                    hour = Number(match[4] || 0),
-                    minute = Number(match[5] || 0),
-                    second = Number(match[6] || 0),
-                    millisecond = Math.floor(Number(match[7] || 0) * 1000),
+                var year = $Number(match[1]),
+                    month = $Number(match[2] || 1) - 1,
+                    day = $Number(match[3] || 1) - 1,
+                    hour = $Number(match[4] || 0),
+                    minute = $Number(match[5] || 0),
+                    second = $Number(match[6] || 0),
+                    millisecond = Math.floor($Number(match[7] || 0) * 1000),
                     // When time zone is missed, local offset should be used
                     // (ES 5.1 bug)
                     // see https://bugs.ecmascript.org/show_bug.cgi?id=112
                     isLocalTime = Boolean(match[4] && !match[8]),
                     signOffset = match[9] === '-' ? 1 : -1,
-                    hourOffset = Number(match[10] || 0),
-                    minuteOffset = Number(match[11] || 0),
+                    hourOffset = $Number(match[10] || 0),
+                    minuteOffset = $Number(match[11] || 0),
                     result;
                 if (
                     hour < (
@@ -1084,10 +1195,11 @@
             }
             return NativeDate.parse.apply(this, arguments);
         };
+        defineProperties(DateShim, { parse: parseShim });
 
         return DateShim;
     }(Date));
-    /*global Date: false */
+    /* global Date: false */
 }
 
 // ES5 15.9.4.4
@@ -1138,11 +1250,11 @@
       var s = '';
       while (--i >= 0) {
           if (s !== '' || i === 0 || toFixedHelpers.data[i] !== 0) {
-              var t = String(toFixedHelpers.data[i]);
+              var t = $String(toFixedHelpers.data[i]);
               if (s === '') {
                   s = t;
               } else {
-                  s += '0000000'.slice(0, 7 - t.length) + t;
+                  s += strSlice('0000000', 0, 7 - t.length) + t;
               }
           }
       }
@@ -1171,14 +1283,14 @@
         var f, x, s, m, e, z, j, k;
 
         // Test for NaN and round fractionDigits down
-        f = Number(fractionDigits);
+        f = $Number(fractionDigits);
         f = f !== f ? 0 : Math.floor(f);
 
         if (f < 0 || f > 20) {
             throw new RangeError('Number.toFixed called with invalid number of 
decimals');
         }
 
-        x = Number(this);
+        x = $Number(this);
 
         // Test for NaN
         if (x !== x) {
@@ -1187,7 +1299,7 @@
 
         // If it is too big or small, return the string value of the number
         if (x <= -1e21 || x >= 1e21) {
-            return String(x);
+            return $String(x);
         }
 
         s = '';
@@ -1233,7 +1345,7 @@
             } else {
                 toFixedHelpers.multiply(0, z);
                 toFixedHelpers.multiply(1 << (-e), 0);
-                m = toFixedHelpers.numToString() + 
'0.00000000000000000000'.slice(2, 2 + f);
+                m = toFixedHelpers.numToString() + 
strSlice('0.00000000000000000000', 2, 2 + f);
             }
         }
 
@@ -1241,9 +1353,9 @@
             k = m.length;
 
             if (k <= f) {
-                m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m;
+                m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m;
             } else {
-                m = s + m.slice(0, k - f) + '.' + m.slice(k - f);
+                m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f);
             }
         } else {
             m = s + m;
@@ -1273,7 +1385,6 @@
 //    ''.split(/.?/) should be [], not [""]
 //    '.'.split(/()()/) should be ["."], not ["", "", "."]
 
-var string_split = StringPrototype.split;
 if (
     'ab'.split(/(?:ab)*/).length !== 2 ||
     '.'.split(/(.?)(.?)/).length !== 4 ||
@@ -1293,7 +1404,7 @@
 
             // If `separator` is not a regex, use native split
             if (!isRegex(separator)) {
-                return string_split.call(this, separator, limit);
+                return strSplit(this, separator, limit);
             }
 
             var output = [];
@@ -1325,11 +1436,11 @@
                 // `separatorCopy.lastIndex` is not reliable cross-browser
                 lastIndex = match.index + match[0].length;
                 if (lastIndex > lastLastIndex) {
-                    output.push(string.slice(lastLastIndex, match.index));
+                    array_push.call(output, strSlice(string, lastLastIndex, 
match.index));
                     // Fix browsers whose `exec` methods don't consistently 
return `undefined` for
                     // nonparticipating capturing groups
                     if (!compliantExecNpcg && match.length > 1) {
-                        /*eslint-disable no-loop-func */
+                        /* eslint-disable no-loop-func */
                         match[0].replace(separator2, function () {
                             for (var i = 1; i < arguments.length - 2; i++) {
                                 if (typeof arguments[i] === 'undefined') {
@@ -1337,10 +1448,10 @@
                                 }
                             }
                         });
-                        /*eslint-enable no-loop-func */
+                        /* eslint-enable no-loop-func */
                     }
                     if (match.length > 1 && match.index < string.length) {
-                        array_push.apply(output, match.slice(1));
+                        array_push.apply(output, array_slice.call(match, 1));
                     }
                     lastLength = match[0].length;
                     lastLastIndex = lastIndex;
@@ -1355,12 +1466,12 @@
             }
             if (lastLastIndex === string.length) {
                 if (lastLength || !separatorCopy.test('')) {
-                    output.push('');
+                    array_push.call(output, '');
                 }
             } else {
-                output.push(string.slice(lastLastIndex));
+                array_push.call(output, strSlice(string, lastLastIndex));
             }
-            return output.length > splitLimit ? output.slice(0, splitLimit) : 
output;
+            return output.length > splitLimit ? strSlice(output, 0, 
splitLimit) : output;
         };
     }());
 
@@ -1373,7 +1484,7 @@
 } else if ('0'.split(void 0, 0).length) {
     StringPrototype.split = function split(separator, limit) {
         if (typeof separator === 'undefined' && limit === 0) { return []; }
-        return string_split.call(this, separator, limit);
+        return strSplit(this, separator, limit);
     };
 }
 
@@ -1381,7 +1492,7 @@
 var replaceReportsGroupsCorrectly = (function () {
     var groups = [];
     'x'.replace(/x(.)?/g, function (match, group) {
-        groups.push(group);
+        array_push.call(groups, group);
     });
     return groups.length === 1 && typeof groups[0] === 'undefined';
 }());
@@ -1399,7 +1510,7 @@
                 searchValue.lastIndex = 0;
                 var args = searchValue.exec(match) || [];
                 searchValue.lastIndex = originalLastIndex;
-                args.push(arguments[length - 2], arguments[length - 1]);
+                array_push.call(args, arguments[length - 2], arguments[length 
- 1]);
                 return replaceValue.apply(this, args);
             };
             return str_replace.call(this, searchValue, wrappedReplaceValue);
@@ -1418,7 +1529,7 @@
     substr: function substr(start, length) {
         var normalizedStart = start;
         if (start < 0) {
-            normalizedStart = Math.max(this.length + start, 0);
+            normalizedStart = max(this.length + start, 0);
         }
         return string_substr.call(this, normalizedStart, length);
     }
@@ -1441,18 +1552,18 @@
         if (typeof this === 'undefined' || this === null) {
             throw new TypeError("can't convert " + this + ' to object');
         }
-        return String(this).replace(trimBeginRegexp, 
'').replace(trimEndRegexp, '');
+        return $String(this).replace(trimBeginRegexp, 
'').replace(trimEndRegexp, '');
     }
 }, hasTrimWhitespaceBug);
 
 // ES-5 15.1.2.2
 if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) {
-    /*global parseInt: true */
+    /* global parseInt: true */
     parseInt = (function (origParseInt) {
         var hexRegex = /^0[xX]/;
         return function parseInt(str, radix) {
-            var string = String(str).trim();
-            var defaultedRadix = Number(radix) || (hexRegex.test(string) ? 16 
: 10);
+            var string = $String(str).trim();
+            var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 
: 10);
             return origParseInt(string, defaultedRadix);
         };
     }(parseInt));
diff --git a/tests/browser/features/step_definitions/create_account_steps.rb 
b/tests/browser/features/step_definitions/create_account_steps.rb
index 3d312f7..98e0f2c 100644
--- a/tests/browser/features/step_definitions/create_account_steps.rb
+++ b/tests/browser/features/step_definitions/create_account_steps.rb
@@ -22,5 +22,5 @@
 end
 
 Then(/^an error message is displayed$/) do
-  expect(on(CreateAccountPage).error_message_element.class_name).to eq 
"errorbox"
+  expect(on(CreateAccountPage).error_message_element.class_name).to eq 
'errorbox'
 end

-- 
To view, visit https://gerrit.wikimedia.org/r/224052
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife16acddc2131c1054392db9bc14385ccc37c38b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to