r106398 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106397‎ | r106398 | r106399 >
Date:00:02, 16 December 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
[WebFonts] Don't loop over an object unfiltered!
* Fixes bug 33154
* Check https://bugzilla.wikimedia.org/show_bug.cgi?id=33154#c13 for elaborate description and trace
Modified paths:
  • /trunk/extensions/WebFonts/resources/ext.webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/resources/ext.webfonts.js
@@ -279,6 +279,10 @@
280280 mw.webfonts.set( $(this).val() );
281281 } );
282282 for ( var scheme in config ) {
 283+ if ( !Object.prototype.hasOwnProperty.call( config, scheme ) ) {
 284+ continue;
 285+ }
 286+
283287 var $fontLink = $( '<input type="radio" name="font" />' )
284288 .attr( 'id', fontID( config[scheme] ) )
285289 .val( config[scheme] );

Follow-up revisions

RevisionCommit summaryAuthorDate
r106418MFT r106398nikerabbit07:56, 16 December 2011

Comments

#Comment by Krinkle (talk | contribs)   00:03, 16 December 2011

Just in case anyone is wondering, I'm using the hasOwnProperty property directly as that's the safest way to do this check. Just being paranoid and safe here :)

#Comment by Brion VIBBER (talk | contribs)   00:07, 16 December 2011

I'd just use config.hasOwnProperty, but this'll do. :)

#Comment by Nikerabbit (talk | contribs)   08:38, 16 December 2011

I don't think this is applicable to 1.18 - we haven't backported anything else to there.

Status & tagging log