r89085 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89084‎ | r89085 | r89086 >
Date:04:11, 29 May 2011
Author:krinkle
Status:ok
Tags:
Comment:
Fix issues raised through TestSwarm
* Instead of delete window.foobar whitelist the global in QUnit.config.pollution
** the reason either is needed is to make QUnit's "noglobal" option useful)
** delete window.foo throws an "TypeError: Object doesn't support this action" in Internet Explorer.
-> http://perfectionkills.com/understanding-delete/
* Remove other globals introduced
Modified paths:
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)
  • /trunk/phase3/tests/qunit/suites/resources/mediawiki.util/mediawiki.util.js (modified) (history)
  • /trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/suites/resources/mediawiki.util/mediawiki.util.js
@@ -50,7 +50,7 @@
5151 test( 'addCSS', function(){
5252 expect(3);
5353
54 - window.a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' );
 54+ var a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' );
5555 ok( a, 'function works' );
5656 deepEqual( a.disabled, false, 'property "disabled" is available and set to false' );
5757
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.js
@@ -64,8 +64,8 @@
6565 deepEqual( 'anotherGlobalMapChecker' in window, true, 'new mw.Map( true ) did store its values in the global window object' );
6666 ok( window.anotherGlobalMapChecker, 'new mw.Map( true ) did store its values in the global window object' );
6767
68 - // Clean up
69 - delete window.anotherGlobalMapChecker;
 68+ // Whitelist this global variable for QUnit 'noglobal' mode
 69+ QUnit.config.pollution.push( 'anotherGlobalMapChecker' );
7070 });
7171
7272 test( 'mw.config', function(){
@@ -111,6 +111,7 @@
112112 deepEqual( goodbye.exists(), false, 'Message.exists() returns false for inexisting messages' );
113113
114114 equal( goodbye.toString(), '<goodbye>', 'Message.toString() returns <key> if key does not exist' );
 115+
115116 });
116117
117118 test( 'mw.msg', function(){
Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -246,11 +246,12 @@
247247 * Gets a message object, similar to wfMessage()
248248 *
249249 * @param key string Key of message to get
250 - * @param parameters mixed First argument in a list of variadic arguments,
 250+ * @param parameter_1 mixed First argument in a list of variadic arguments,
251251 * each a parameter for $N replacement in messages.
252252 * @return Message
253253 */
254254 this.message = function( key, parameter_1 /* [, parameter_2] */ ) {
 255+ var parameters;
255256 // Support variadic arguments
256257 if ( parameter_1 !== undefined ) {
257258 parameters = $.makeArray( arguments );

Follow-up revisions

RevisionCommit summaryAuthorDate
r89086Only whitelist it if QUnit is in that mode though (bug in QUnit?), caused it ...krinkle04:19, 29 May 2011

Status & tagging log