r93805 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93804‎ | r93805 | r93806 >
Date:07:45, 3 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
Follows-up r89848 CR: Cleaner solution
Modified paths:
  • /trunk/phase3/resources/mediawiki/mediawiki.util.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki/mediawiki.util.js
@@ -555,10 +555,13 @@
556556 * @return boolean
557557 */
558558 'isIPv4Address' : function( address, allowBlock ) {
 559+ if ( typeof address !== 'string' ) {
 560+ return false;
 561+ }
559562 var block = allowBlock ? '(?:\\/(?:3[0-2]|[12]?\\d))?' : '';
560563 var RE_IP_BYTE = '(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[0-9])';
561564 var RE_IP_ADD = '(?:' + RE_IP_BYTE + '\\.){3}' + RE_IP_BYTE;
562 - return typeof address === 'string' && address.search( new RegExp( '^' + RE_IP_ADD + block + '$' ) ) != -1;
 565+ return address.search( new RegExp( '^' + RE_IP_ADD + block + '$' ) ) != -1;
563566 },
564567 /**
565568 * Note: borrows from IP::isIPv6

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89848Follow-up: r89845: Forgot to commit changes in the other directorykrinkle20:08, 10 June 2011

Status & tagging log