r82340 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82339‎ | r82340 | r82341 >
Date:17:08, 17 February 2011
Author:catrope
Status:reverted (Comments)
Tags:
Comment:
(bug 27492) Fix regexes for matching JS regexes which could get messed up by the minifier in extreme circumstances
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]+(\\/[^\\/\\r\\n\\*][^\\/\\r\\n]*\\/g?i?)/', '$2' );
85 - $parser->add( '/[^\\w\\$\\/\'"*)\\?:]\\/[^\\/\\r\\n\\*][^\\/\\r\\n]*\\/g?i?/', '$1' );
 84+ $parser->add( '/([ \\t]+(\\/(?=[^\\/\\r\\n\\*])[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' );
 85+ $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/(?=[^\\/\\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
r82344Revert r82340, caused something linke bug 27481 where spaces were being wrong...catrope19:19, 17 February 2011
r823501.17wmf1: MFT r81207, r82340, r82344 (JS minfier fixes)catrope21:49, 17 February 2011
r85290Per Roan, pull JavaScriptDistiller from trunk since it won't merge cleanly. T...demon22:22, 3 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   18:59, 17 February 2011

Did we get tests yet? Those regexps look impossible to understand.

Status & tagging log