From: Matthew Flaschen Date: Wed, 13 Sep 2017 02:22:33 +0000 (-0400) Subject: RCFilters: Preference length is in bytes, so use $.byteLength X-Git-Tag: 1.31.0-rc.0~2122^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/wiki/supprimer.php?a=commitdiff_plain;h=8314e51cdda165813fb781659cb958def5435ec6;p=lhc%2Fweb%2Fwiklou.git RCFilters: Preference length is in bytes, so use $.byteLength Also, a minor fix to $.byteLength docs Change-Id: I0f93edb0cb61a057da5ce0876b74cd17179c6587 --- diff --git a/resources/Resources.php b/resources/Resources.php index f0aa9ecbca..ca922a350b 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1772,6 +1772,7 @@ return [ 'resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js', ], 'dependencies' => [ + 'jquery.byteLength', 'oojs', 'mediawiki.api', 'mediawiki.api.options', diff --git a/resources/src/jquery/jquery.byteLength.js b/resources/src/jquery/jquery.byteLength.js index 7fe25ee30c..222f14afd8 100644 --- a/resources/src/jquery/jquery.byteLength.js +++ b/resources/src/jquery/jquery.byteLength.js @@ -11,7 +11,7 @@ * @static * @inheritable * @param {string} str - * @return {string} + * @return {number} */ jQuery.byteLength = function ( str ) { // This basically figures out how many bytes a UTF-16 string (which is what js sees) diff --git a/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js b/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js index f37229f725..ee74ac5f97 100644 --- a/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js +++ b/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js @@ -863,7 +863,7 @@ // Stringify state stringified = JSON.stringify( state ); - if ( stringified.length > 65535 ) { + if ( $.byteLength( stringified ) > 65535 ) { // Sanity check, since the preference can only hold that. return; }