r82352 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82351‎ | r82352 | r82353 >
Date:22:07, 17 February 2011
Author:catrope
Status:ok
Tags:
Comment:
Fix for r82344, which causes JSDistiller to stop minifying comments because it thought they were regexes. Make the regex regex a little bit stricter again, forbidding a regex from starting with * and other invalid things that were disallowed prior to r82344 (but still dropping / ) and forbidding multiline regexes
Modified paths:
  • /trunk/phase3/includes/libs/JavaScriptDistiller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/libs/JavaScriptDistiller.php
@@ -80,8 +80,8 @@
8181 $parser->add( '/\'([^\'\\\\]*(\\\\.[^\'\\\\]*)*)\'/', '$1' );
8282 $parser->add( '/"([^"\\\\]*(\\\\.[^"\\\\]*)*)"/', '$1' );
8383 // Protect regular expressions
84 - $parser->add( '/[ \\t]+((\\/[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' );
85 - $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' );
 84+ $parser->add( '/[ \\t]+((\\/[^\\r\\n\\*][^\\/\\r\\n\\\\]*(\\\\.[^\\/\\r\\n\\\\]*)*\\/(i|g)*))/', '$1' );
 85+ $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/[^\\r\\n\\*][^\\/\\r\\n\\\\]*(\\\\.[^\\/\\r\\n\\\\]*)*\\/(i|g)*))/', '$1' );
8686 // Remove comments
8787 $parser->add( '/\\/\\*(.|[\\r\\n])*?\\*\\//' );
8888 // Preserve the newline after a C++-style comment -- bug 27046

Follow-up revisions

RevisionCommit summaryAuthorDate
r823531.17wmf1: MFT r82352catrope22:07, 17 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82344Revert r82340, caused something linke bug 27481 where spaces were being wrong...catrope19:19, 17 February 2011

Status & tagging log