Merge "resourceloader: Simplify StringSet fallback"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 20 Sep 2018 07:58:03 +0000 (07:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 20 Sep 2018 07:58:03 +0000 (07:58 +0000)
1  2 
resources/src/startup/mediawiki.js

  
        function defineFallbacks() {
                // <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set>
-               StringSet = window.Set || ( function () {
-                       /**
-                        * @private
-                        * @class
-                        */
-                       function StringSet() {
-                               this.set = Object.create( null );
-                       }
-                       StringSet.prototype.add = function ( value ) {
-                               this.set[ value ] = true;
+               /**
+                * @private
+                * @class
+                */
+               StringSet = window.Set || function StringSet() {
+                       var set = Object.create( null );
+                       this.add = function ( value ) {
+                               set[ value ] = true;
                        };
-                       StringSet.prototype.has = function ( value ) {
-                               return value in this.set;
+                       this.has = function ( value ) {
+                               return value in set;
                        };
-                       return StringSet;
-               }() );
+               };
        }
  
        /**
  
        defineFallbacks();
  
 -      /* eslint-disable no-console */
        log = ( function () {
                /**
                 * Write a verbose message to the browser's console in debug mode.
                 *
                 * @param {...string} msg Messages to output to console
                 */
 -              log.warn = console && console.warn && Function.prototype.bind ?
 +              log.warn = console && console.warn ?
                        Function.prototype.bind.call( console.warn, console ) :
                        function () {};
  
                 * @since 1.26
                 * @param {...Mixed} msg Messages to output to console
                 */
 -              log.error = console && console.error && Function.prototype.bind ?
 +              log.error = console && console.error ?
                        Function.prototype.bind.call( console.error, console ) :
                        function () {};
  
                 * @param {string} [logName=key] Optional custom name for the feature.
                 *  This is used instead of `key` in the message and `mw.deprecate` tracking.
                 */
 -              log.deprecate = !Object.defineProperty ? function ( obj, key, val ) {
 -                      obj[ key ] = val;
 -              } : function ( obj, key, val, msg, logName ) {
 +              log.deprecate = function ( obj, key, val, msg, logName ) {
                        var stacks;
                        function maybeLog() {
                                var name,
  
                return log;
        }() );
 -      /* eslint-enable no-console */
  
        /**
         * @class mw