r87840 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87839‎ | r87840 | r87841 >
Date:20:14, 10 May 2011
Author:brion
Status:ok (Comments)
Tags:
Comment:
* (bug 25262) Fix for minification of hardcoded data: URIs in CSS

CSSMin::minify()'s processing of url references for path adjustment or embedding had excluded explicit fully-qualified http: and https: URLs, but was damaging others such as data: URIs that were actually hardcoded into the original CSS.
This was affecting styles used on no.wikipedia.org which embedded a few icons directly into the style sheet.
Now checking for any URL scheme rather than hardcoding a check for http & https.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.18 (modified) (history)
  • /trunk/phase3/includes/libs/CSSMin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.18
@@ -250,6 +250,7 @@
251251 * (bug 28076) Thumbnail height limited to 360 pixels on Special:Listfiles
252252 * (bug 22227) Special:Listfiles no longer throws an error on bogus file entries
253253 * (bug 19408) user_properties.up_property: 32 bytes is not enough.
 254+* (bug 25262) Fix for minification of hardcoded data: URIs in CSS
254255
255256 === API changes in 1.18 ===
256257 * (bug 26339) Throw warning when truncating an overlarge API result.
Index: trunk/phase3/includes/libs/CSSMin.php
@@ -120,8 +120,9 @@
121121 self::URL_REGEX . '(?P<post>[^;]*)[\;]?/';
122122 $offset = 0;
123123 while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) {
124 - // Skip absolute URIs
125 - if ( preg_match( '/^https?:\/\//', $match['file'][0] ) ) {
 124+ // Skip fully-qualified URLs and data URIs
 125+ $urlScheme = parse_url( $match['file'][0], PHP_URL_SCHEME );
 126+ if ( $urlScheme ) {
126127 // Move the offset to the end of the match, leaving it alone
127128 $offset = $match[0][1] + strlen( $match[0][0] );
128129 continue;

Follow-up revisions

RevisionCommit summaryAuthorDate
r896761.17: MFT r82247, r87203, r87265, r87494, r87497, r87711, r87840, r88076, r89615catrope19:09, 7 June 2011
r90258MFT r87586, r87840, r88085, r88118, r88124, r88492, r88498tstarling04:46, 17 June 2011
r922781.17wmf1 MFT r82748, r87840, r89401, r89697reedy19:01, 15 July 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   20:16, 10 May 2011

Tagging for merge to 1.17, 1.17-wmf1, 1.18 branches.

Status & tagging log