jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/313231 )

Change subject: resourceloader: Undeprecate mw.Map#values
......................................................................


resourceloader: Undeprecate mw.Map#values

Follows-up dc0f9b3a3a, which renamed #values to #internalValues to ease
migration to ES5 Map where such object could no longer exist in
real-time as a plain object.

However ES5 Map for mw.Map is no longer on the roadmap per T146432.
The main reason for adopting ES5 was performance, which turns out
to be invalid and was merely a bug in V8 that has since been fixed.

Change this back and undeprecate it. If anything, for developer
convience and type-ahead, which is fairly wildely used.

Change-Id: Ic19641656e53068a0aa15c27f172d39eb13620dd
---
M resources/src/mediawiki/mediawiki.js
M tests/qunit/suites/resources/mediawiki/mediawiki.test.js
2 files changed, 12 insertions(+), 26 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/src/mediawiki/mediawiki.js 
b/resources/src/mediawiki/mediawiki.js
index 7872818..00b275f 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -82,9 +82,8 @@
         *  copied in one direction only. Changes to globals do not reflect in 
the map.
         */
        function Map( global ) {
-               this.internalValues = {};
+               this.values = {};
                if ( global === true ) {
-
                        // Override #set to also set the global variable
                        this.set = function ( selection, value ) {
                                var s;
@@ -102,15 +101,6 @@
                                return false;
                        };
                }
-
-               // Deprecated since MediaWiki 1.28
-               log.deprecate(
-                       this,
-                       'values',
-                       this.internalValues,
-                       'mw.Map#values is deprecated. Use mw.Map#get() 
instead.',
-                       'Map-values'
-               );
        }
 
        /**
@@ -123,7 +113,7 @@
         * @param {Mixed} value
         */
        function setGlobalMapValue( map, key, value ) {
-               map.internalValues[ key ] = value;
+               map.values[ key ] = value;
                log.deprecate(
                                window,
                                key,
@@ -164,14 +154,13 @@
                        }
 
                        if ( typeof selection === 'string' ) {
-                               if ( !hasOwn.call( this.internalValues, 
selection ) ) {
-                                       return fallback;
-                               }
-                               return this.internalValues[ selection ];
+                               return hasOwn.call( this.values, selection ) ?
+                                       this.values[ selection ] :
+                                       fallback;
                        }
 
                        if ( selection === undefined ) {
-                               return this.internalValues;
+                               return this.values;
                        }
 
                        // Invalid selection key
@@ -190,12 +179,12 @@
 
                        if ( $.isPlainObject( selection ) ) {
                                for ( s in selection ) {
-                                       this.internalValues[ s ] = selection[ s 
];
+                                       this.values[ s ] = selection[ s ];
                                }
                                return true;
                        }
                        if ( typeof selection === 'string' && arguments.length 
> 1 ) {
-                               this.internalValues[ selection ] = value;
+                               this.values[ selection ] = value;
                                return true;
                        }
                        return false;
@@ -208,17 +197,16 @@
                 * @return {boolean} True if the key(s) exist
                 */
                exists: function ( selection ) {
-                       var s;
-
+                       var i;
                        if ( $.isArray( selection ) ) {
-                               for ( s = 0; s < selection.length; s++ ) {
-                                       if ( typeof selection[ s ] !== 'string' 
|| !hasOwn.call( this.internalValues, selection[ s ] ) ) {
+                               for ( i = 0; i < selection.length; i++ ) {
+                                       if ( typeof selection[ i ] !== 'string' 
|| !hasOwn.call( this.values, selection[ i ] ) ) {
                                                return false;
                                        }
                                }
                                return true;
                        }
-                       return typeof selection === 'string' && hasOwn.call( 
this.internalValues, selection );
+                       return typeof selection === 'string' && hasOwn.call( 
this.values, selection );
                }
        };
 
diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.test.js 
b/tests/qunit/suites/resources/mediawiki/mediawiki.test.js
index d3e73ae..697f32d 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.test.js
@@ -141,9 +141,7 @@
                }, 'Map.get return includes keys that were not found as null 
values' );
 
                // Interacting with globals and accessing the values object
-               this.suppressWarnings();
                assert.strictEqual( conf.get(), conf.values, 'Map.get returns 
the entire values object by reference (if called without arguments)' );
-               this.restoreWarnings();
 
                conf.set( 'globalMapChecker', 'Hi' );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic19641656e53068a0aa15c27f172d39eb13620dd
Gerrit-PatchSet: 14
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: Fomafix <foma...@googlemail.com>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to