Page MenuHomePhabricator

JS minifier breaks URLs in CSS strings
Closed, ResolvedPublic

Description

On http://translatewiki.net/wiki/Thread:Support/Page_last_modified there is:

<pre>
...
( jQuery ) );

}, {"all": ".ui-button{display:inline-block; ... background:#e1e1e1 url(http:

mediaWiki.loader.implement("jquery.ui.core",function($,mw){ ...
</pre>

" ... " is inserted by me and not in the actual code

The "SyntaxError: Parse error" traces back to directly after "http:"

ie. the "" in http: was treated as a comment. I'm not sure whether this is caused by the CSS minifer or by the javascript minifier that ran afterwards.

In the end obviously the JavaScript minifier is the one removing the // comment, but the root cause could be in the CSS minifier.

Possible work around:
Don't minify the end output of load.php (ie. the "mediaWiki.loader.implement" calls), but only run javascript minify on the modules themselfs between { and } of the implemenet() call, and the CSS minifer on what is in the later argument.
Reason being that the call to mediaWiki.loader.load are so simple there's no need to minify them, it would only bring in extra unneeded risks such as the js minifier screwing in the css-string.

Ofcourse that's not a permanent solution as there could be a css string like that inside a module as well such as:

$(el).attr('style', 'background: url(http:// ...
or
appendCSS( 'el { background: url(http:// ...

This is breaking javascript execution completely on some pages of TranslateWiki.net

Krinkle


Version: unspecified
Severity: critical

Details

Reference
bz27396

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:16 PM
bzimport set Reference to bz27396.

Are you sure this is reproducible on either trunk, REL1_17 or 1.17wmf1? I fixed this a few days ago, and TWN might just be running old code.

It looks ugly on twn, but seems fine on mw.org. This+Roan's comment makes me think it isn't a blocker for now.

This should be fixed now. Closing as FIXED, please REOPEN if new problems arise.