jenkins-bot has submitted this change and it was merged.
Change subject: mediawiki.jqueryMsg: Remove 'astCache'
......................................................................
mediawiki.jqueryMsg: Remove 'astCache'
All it does is cause problems.
Bug: T54042
Change-Id: I955ee61f6c0040203959ab8f45efb56a32431768
(cherry picked from commit 0502108b956ee93a0493a26b630b3052a10150b6)
---
M resources/src/mediawiki/mediawiki.jqueryMsg.js
1 file changed, 4 insertions(+), 34 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/src/mediawiki/mediawiki.jqueryMsg.js
b/resources/src/mediawiki/mediawiki.jqueryMsg.js
index 544a608..253ad44 100644
--- a/resources/src/mediawiki/mediawiki.jqueryMsg.js
+++ b/resources/src/mediawiki/mediawiki.jqueryMsg.js
@@ -257,29 +257,6 @@
mw.jqueryMsg.parser.prototype = {
/**
- * Cache mapping MediaWiki message keys and the value
onlyCurlyBraceTransform, to the AST of the message.
- *
- * In most cases, the message is a string so this is identical.
- * (This is why we would like to move this functionality
server-side).
- *
- * The two parts of the key are separated by colon. For
example:
- *
- * "message-key:true": ast
- *
- * if they key is "message-key" and onlyCurlyBraceTransform is
true.
- *
- * This cache is shared by all instances of mw.jqueryMsg.parser.
- *
- * NOTE: We promise, it's static - when you create this empty
object
- * in the prototype, each new instance of the class gets a
reference
- * to the same object.
- *
- * @static
- * @property {Object}
- */
- astCache: {},
-
- /**
* Where the magic happens.
* Parses a message from the key, and swaps in replacements as
necessary, wraps in jQuery
* If an error is thrown, returns original key, and logs the
error
@@ -300,17 +277,11 @@
* @return {string|Array} string of '[key]' if message missing,
simple string if possible, array of arrays if needs parsing
*/
getAst: function ( key ) {
- var wikiText,
- cacheKey = [ key,
this.settings.onlyCurlyBraceTransform ].join( ':' );
-
- if ( this.astCache[ cacheKey ] === undefined ) {
- wikiText = this.settings.messages.get( key );
- if ( typeof wikiText !== 'string' ) {
- wikiText = '\\[' + key + '\\]';
- }
- this.astCache[ cacheKey ] = this.wikiTextToAst(
wikiText );
+ var wikiText = this.settings.messages.get( key );
+ if ( typeof wikiText !== 'string' ) {
+ wikiText = '\\[' + key + '\\]';
}
- return this.astCache[ cacheKey ];
+ return this.wikiTextToAst( wikiText );
},
/**
@@ -899,7 +870,6 @@
// I am deferring the work of turning it into
prototypes & objects. It's quite fast enough
// finally let's do some actual work...
- // If you add another possible rootExpression, you must
update the astCache key scheme.
result = start( this.settings.onlyCurlyBraceTransform ?
curlyBraceTransformExpression : expression );
/*
--
To view, visit https://gerrit.wikimedia.org/r/249133
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I955ee61f6c0040203959ab8f45efb56a32431768
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_26
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Edokter <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits