From: Roan Kattouw Date: Mon, 31 Jan 2011 12:48:08 +0000 (+0000) Subject: (bug 27046) Do not strip newlines following C++-style // comments. Prior to this... X-Git-Tag: 1.31.0-rc.0~32291 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22config_fonctions%22%2C%20%22image_process=%24process%22%29%20.%20%22?a=commitdiff_plain;h=3d6c28a9db409bd0c1aea4b30fb2af35f955a145;p=lhc%2Fweb%2Fwiklou.git (bug 27046) Do not strip newlines following C++-style // comments. Prior to this commit, such newlines were always stripped, causing invalid JS output in certain cases. They are now always preserved, even if they would normally qualifiy for vertical whitespace stripping/collapsing when wgResourceLoaderMinifyJSVerticalSpace is enabled. --- diff --git a/includes/libs/JavaScriptDistiller.php b/includes/libs/JavaScriptDistiller.php index ff2a0b2848..3e0a00f8fe 100644 --- a/includes/libs/JavaScriptDistiller.php +++ b/includes/libs/JavaScriptDistiller.php @@ -84,7 +84,8 @@ class JavaScriptDistiller { $parser->add( '/[^\\w\\$\\/\'"*)\\?:]\\/[^\\/\\r\\n\\*][^\\/\\r\\n]*\\/g?i?/', '$1' ); // Remove comments $parser->add( '/\\/\\*(.|[\\r\\n])*?\\*\\//' ); - $parser->add( '/\\/\\/[^\\r\\n]*[\\r\\n]/' ); + // Preserve the newline after a C++-style comment -- bug 27046 + $parser->add( '/\\/\\/[^\\r\\n]*([\\r\\n])/', '$2' ); return $parser; } }