r91341 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91340‎ | r91341 | r91342 >
Date:08:32, 2 July 2011
Author:hartman
Status:ok
Tags:
Comment:
Patch to replace for-in with for(;;)

This breaks when strange things are added to Array.prototype (and you never know what users do in their user scripts), so use for (var i = 0; i < ...length; i++ ) instead.

Fixes 29676. Patch courtesy of Micheal M.
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.client.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.client.js
@@ -183,10 +183,10 @@
184184 // Unknown, so we assume it's working
185185 return true;
186186 }
187 - var name = map[dir][profile.name];
188 - for ( var condition in name ) {
189 - var op = name[condition][0];
190 - var val = name[condition][1];
 187+ var conditions = map[dir][profile.name];
 188+ for ( var i = 0; i < conditions.length; i++ ) {
 189+ var op = conditions[i][0];
 190+ var val = conditions[i][1];
191191 if ( val === false ) {
192192 return false;
193193 } else if ( typeof val == 'string' ) {

Status & tagging log