Subramanya Sastry has submitted this change and it was merged.

Change subject: Freeze some static values in WikiConfig
......................................................................


Freeze some static values in WikiConfig

Any changes to these would be bugs, and could lead to weird effects like
loading templates from another wiki.

Makes sure any attempt to modify the default values fails by freezing those
values.

Change-Id: Id198fcd285b179d9efa3698affe7e97bff95900b
---
M js/lib/mediawiki.WikiConfig.js
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Subramanya Sastry: Verified; Looks good to me, approved



diff --git a/js/lib/mediawiki.WikiConfig.js b/js/lib/mediawiki.WikiConfig.js
index 012ec69..3cc84e5 100644
--- a/js/lib/mediawiki.WikiConfig.js
+++ b/js/lib/mediawiki.WikiConfig.js
@@ -6,6 +6,9 @@
        Util = require( './mediawiki.Util.js' ).Util,
        request = require( 'request' );
 
+// Make sure our base config is never modified
+Util.deepFreeze(baseConfig);
+
 // escape 'special' characters in a regexp, returning a regexp which matches
 // the string exactly
 var re_escape = function(s) {
@@ -504,7 +507,8 @@
                delete this.extensionTags[tagName];
        }
 };
-Object.freeze(WikiConfig.prototype.canonicalNamespaces);
+// Make sure the prototype is never modified
+Util.deepFreeze(WikiConfig.prototype);
 
 if ( typeof module === 'object' ) {
        module.exports.WikiConfig = WikiConfig;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id198fcd285b179d9efa3698affe7e97bff95900b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to