Merge "resourceloader: Remove use of $.params in mediawiki.js"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 30 May 2018 14:42:18 +0000 (14:42 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 30 May 2018 14:42:18 +0000 (14:42 +0000)
resources/src/mediawiki/mediawiki.js

index 2d3f6ad..b00cbff 100644 (file)
                                }
                        }
 
+                       /**
+                        * @private
+                        * @param {Object} params Map of parameter names to values
+                        * @return {string}
+                        */
+                       function makeQueryString( params ) {
+                               return Object.keys( params ).map( function ( key ) {
+                                       return encodeURIComponent( key ) + '=' + encodeURIComponent( params[ key ] );
+                               } ).join( '&' );
+                       }
+
                        /**
                         * Create network requests for a batch of modules.
                         *
                                        // combining versions from the module query string in-order. (T188076)
                                        query.version = getCombinedVersion( packed.list );
                                        query = sortQuery( query );
-                                       addScript( sourceLoadScript + '?' + $.param( query ) );
+                                       addScript( sourceLoadScript + '?' + makeQueryString( query ) );
                                }
 
                                if ( !batch.length ) {
                                                // > '&modules='.length === 9
                                                // > '&version=1234567'.length === 16
                                                // > 9 + 16 = 25
-                                               currReqBaseLength = $.param( currReqBase ).length + 25;
+                                               currReqBaseLength = makeQueryString( currReqBase ).length + 25;
 
                                                // We may need to split up the request to honor the query string length limit,
                                                // so build it piece by piece.