r82344 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82343‎ | r82344 | r82345 >
Date:19:19, 17 February 2011
Author:catrope
Status:ok
Tags:
Comment:
Revert r82340, caused something linke bug 27481 where spaces were being wrongly collapsed. Fixed by changing regex to be more flexible in protecting regexes; nothing wrong with being overinclusive in what we're protecting
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\\*])[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' );
85 - $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/(?=[^\\/\\r\\n\\*])[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' );
 84+ $parser->add( '/[ \\t]+((\\/[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' );
 85+ $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(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
r823501.17wmf1: MFT r81207, r82340, r82344 (JS minfier fixes)catrope21:49, 17 February 2011
r82352Fix for r82344, which causes JSDistiller to stop minifying comments because i...catrope22:07, 17 February 2011
r82357Fix a bug in string recognition in JSDistiller. This *really* fixes bug 27481catrope22:36, 17 February 2011
r85290Per Roan, pull JavaScriptDistiller from trunk since it won't merge cleanly. T...demon22:22, 3 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82340(bug 27492) Fix regexes for matching JS regexes which could get messed up by ...catrope17:08, 17 February 2011

Status & tagging log