Commit graph

20 commits

Author SHA1 Message Date
Ori Livneh
3ecec5434e Only convert boolean true/false to !0/!1
Fix-up for I5ab29b686b8. If we encounter stupid code like
`a.true = 1;` or `a = { true: 1 }`, we should not convert that to !0/!1.
Because JSMin barfs on such input, it is necessary to add another parameter to
the test method which specifies whether or not the minified JavaScript is
supposed to be valid JavaScript by the standards of JSMin.

Change-Id: Ib78c628147fdb95982d6e33e0ab298584fb63d0b
2015-08-15 14:13:59 -07:00
Ori Livneh
a44fe77c62 JavaScriptMinifier: minify booleans
Minify true to !0 and false to !1, like Google Closure Compiler and UglifyJS2.

Change-Id: I5ab29b686b812d64a2913611be091084c06d630b
2015-08-14 17:51:59 +00:00
Siebrand Mazeland
c0c39640e4 Make phpcs-strict pass on includes/ (5/~10)
Change-Id: I259f3f11cfc22f3ed1693f9ebd5bd80491b8a6e8
2014-05-11 19:35:32 +00:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
c157f4d424 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I52ae3c55044bc8c53698e356bad74969406670bf
2012-10-20 13:32:35 +02:00
Alexandre Emsenhuber
63176b99b7 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I1deb70318d01a257b51948ba806d80cd1a239f4f
2012-05-04 08:47:07 +02:00
Brion Vibber
e97346ec18 Revert r103978, r103979 -- screwed something up, breaks jQuery minification.
Incremented ResourceLoader::filterCacheVersion rather than decrementing to avoid potential confusion, especially since we already needed the incr.
2011-11-23 00:22:46 +00:00
Brion Vibber
956de0db3f Functional part of r103978 (d'oh!) plus an update to the ResourceLoader filter cache key, so broken entries stuck in cache will be reloaded. 2011-11-22 23:20:50 +00:00
Platonides
a82a7940f6 Final fixup to r103910 and follow-ups.
Reverts r103931 test change.
2011-11-22 18:56:55 +00:00
Platonides
6cac97e88c Two decimal points may be valid, as 5..toString() == (5.).toString()
Added some tests
2011-11-22 18:42:21 +00:00
Platonides
b23dc2f758 Follow-up r103915: We need to increment $end before the strcspn.
Adjusting the tests, since it is now adding the newline after the number.
2011-11-22 18:10:25 +00:00
Platonides
7b9e098668 Follow-up r103915. The @fixme of r103865 was wrong.
It is apparently legal to have a decimal point without after it, 
eg. var a = 5.
Not for hexadecimal numbers.
2011-11-22 17:48:32 +00:00
Platonides
4417d4cfbe Fix r103865 fixmes about case where there a parse error should be raised.
Also detect as an error 1..0 or 1eeeeee5
2011-11-22 16:21:18 +00:00
Platonides
f0e8973335 Follow-up r103865. Accept lowercase hex and remove empty statement. 2011-11-22 16:04:39 +00:00
Brion Vibber
3e415f816f * (bug 32548) fix minification bug when numeric literal with exponent was split over lines
This broke the OpenLayers support in the Maps extension, as used for example on TranslateWiki.net.
The original JavaScriptMinifier's tokenizer (r83885) explicitly didn't bother looking for the exponent part because it "didn't matter" to its internal state machine; however since r83891 added a max line length that definitely is not true.

I've split out handling of hex and decimal numerals, and let the decimal numeral handling check for exponents.

PHPUnit test cases were added in r103846.
2011-11-21 23:16:36 +00:00
Neil Kandalgaonkar
388d13ce42 removing another use of the vertical tab & form feed escapes, which are not available in production php5.2.4 2011-03-15 04:41:15 +00:00
Neil Kandalgaonkar
50a412b7d3 the vertical tab \v and form feed \f escapes are not available in php5.2.4 which is what we run in production. Using equivalent hexadecimal 2011-03-15 04:37:06 +00:00
Roan Kattouw
27508f06af Followup r83891: don't insert a newline before ++ or -- . Patch by Paul Copperman 2011-03-14 18:04:39 +00:00
Roan Kattouw
47d5ad564b Followup r83885: implement maximum line length and statement termination (each statement on its own line) in JavaScriptMinifier. Also add globals for these things and update minify.php for these new config vars. 2011-03-14 13:24:30 +00:00
Roan Kattouw
867fc1cba8 (bug 27528) Incorporate Paul Copperman's minifier 2011-03-14 11:44:33 +00:00