Commit graph

99 commits

Author SHA1 Message Date
Reedy
ea73ea64ea Simplify getNewOffset()
Remove @ingroup Diff comment which seems to have come from the extension

Change-Id: I2a357bde2b4298315ef05a619a05b56b0ce4dca2
2012-09-26 17:05:47 +01:00
Catrope
e4fbf314fe Work around preg_replace_callback() issue in CSSJanus
As reported in bug 38294, CSSJanus returns an empty string for some
input. This seems to be caused by preg_replace_callback() returning
null which, according to the PHP docs, happens "in case of error". Of
course there's no way to figure out what the error was :S

Work around this by checking for a null return value

Change-Id: I5db952bc32f73b94ac13e449d9aa1f8693602dbd
2012-08-28 12:35:27 -07:00
jeroendedauw
11d290fe7b use InvalidArgumentException rather then Exception
Change-Id: Ie744c773b316278e4a92af28354a8fe4eb83b78f
2012-08-27 13:34:02 +02:00
jeroendedauw
afe46f1403 Added GenericArrayObject class and associated test base
Change-Id: Id7e9b59c7ed4a9338744db58935307ecb4bc441f
2012-08-13 20:18:48 -07:00
Timo Tijhof
90fd3bdea5 CSSMin: Clean up $remote trailing slash fix
* No need to strip them from everywhere all over. This bug is only
  caused by the presence of a trailing slash on $remote.

* To make sure everything still works before and after I added
  unit tests for CSSMin in Ic9195614acfd, making this dependent
  on that change.

Change-Id: Ia82048a328a056117afe0d653fe22f5429b21f5a
2012-06-20 14:30:10 +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
Sam Reed
7b25f8231f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:30:01 +00:00
Sam Reed
f3cc77aaee Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:41:50 +00:00
Roan Kattouw
2d3862484c Fix bug in CSSJanus where background-position and background-position-x weren't flipped if negative values were given. Trevor found this by running the original CSSJanus test suite against his NodeJS port; I should port the test suite to PHPUnit some time 2012-02-02 16:31:42 +00:00
Roan Kattouw
23ab0f7162 (bug 34114) CSSMin::remap() doesn't respect its $embed parameter. Patch by Gilles van den Hoven 2012-02-02 10:30:57 +00: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
Sam Reed
4622da783c More documentation! 2011-10-26 04:15:09 +00:00
Sam Reed
27665d27ae Update some deprecated code
Documentation

Fix "/*" comments to "/**"

Flesh out some missing returns, change some return types
2011-10-14 21:18:38 +00:00
Brion Vibber
72ba305da4 * (bug 31187) Fix for user JavaScript validation to allow identifiers with valid Unicode letter characters
Followup r91591, r93020: patch to jsminplus to support Unicode chars and char escapes in identifiers

Fast-path check keeps runtime about the same on most scripts (eg jquery.js parsing was abround 4100ms both before and after on my test machine)
Slow-path code kicks in if plain ASCII word chars don't extend all the way to the next whitespace or punctuation char.
Using PCRE's Unicode properties magic to ensure that we're catching everything, following ECMA-262 edition 5.1 spec.

Note that identifiers using escapes don't get normalized to their UTF-8 form; this might be a nice thing to do as it saves a couple bytes, but currently there's no change made to output.


Added QUnit tests to verify that unicode letter & escapes work in identifiers in all supported browsers (ok back to IE 6, yay)
2011-09-27 22:51:36 +00:00
Roan Kattouw
b3599d8f8c Followup to r92580 and r93820: r92580 duplicated the call to wfExpandUrl(), and r93820 caused them to get out of sync. 2011-08-14 13:35:06 +00:00
Roan Kattouw
3e0a770524 Fix syntax error in r93820 2011-08-03 13:12:55 +00:00
Roan Kattouw
ae7d7676fb Fix r93820: PROT_ -> PROTO_ 2011-08-03 13:11:42 +00:00
Roan Kattouw
6adb2e86a5 Some random URL protocol forcing for protocol-relative URLs 2011-08-03 12:58:21 +00:00
Roan Kattouw
11e642cab5 Clarify dual-licensing (GPL&Apache) of CSSJanus. Has no significant contributions (i.e. changes other than very minor whitespace and Doxygen changes) by anyone other than me. 2011-07-31 01:32:19 +00:00
Platonides
1a6fed0dd7 Update JSMin+ to the newly released 1.4
This upstream release incorporates r92560 and r92563
2011-07-24 21:46:51 +00:00
Roan Kattouw
cb8418647f Fixes for URL expanding in CSSMin: adjust the offset correctly (this could've theoretically resulted in very strange bugs) and only call wfExpandUrl() if available (the file is in includes/libs so it should work outside of MediaWiki) 2011-07-19 21:19:50 +00:00
Platonides
078057888a Expand the defines from JSTokenizer::__construct() placing them at the top of the file.
This fixes the Notices that would be produced if several JSTokenizer were instantiated.
jsminplus was added in r91591.

Defines code was generated with:
$js = new JSTokenizer();
foreach ($js->opTypeNames as $operand => $name) echo "define('OP_$name', '$operand');\n";
foreach ($js->keywords as $keyword) echo "define('KEYWORD_" . strtoupper($keyword) . "', '$keyword');\n";
2011-07-19 20:03:41 +00:00
Platonides
6bb98564f5 Remove double ; and final ?> from jsminplus (imported in r91591).
This should be uncontroversial.
2011-07-19 19:53:00 +00:00
Brion Vibber
12ccca0349 Followup r83885: add JSMin+ 1.3 to use its parser to verify output of JavaScriptMinifierTest unit test cases. Had to change some of the test cases because they were not valid JavaScript programs -- one of the quoting tests was incorrectly quoted in the PHP sources, and several tests around return, continue, and break keywords failed due to not using them in the contexts that they require.
http://crisp.tweakblogs.net/blog/1856/jsmin+-version-13.html
JSMin+ under MPL 1.1/ GPL 2.0 / LGPL 2.1 license.
2011-07-06 20:02:10 +00:00
Antoine Musso
a2d41b8d6f HTTP status messages move: OutputPage -> HttpStatus
OutputPage::getStatusMessage() is a method to convert a numeric HTTP status
code to an english message.  It does not really belong to the OutputPage were
it was for historical reason.
This patch move the basic function to a non MediaWiki dependant class in our
directory includes/libs.  We could potentially enhances it, but I do not see
any use cases for us yet.
I have renamed the method to the shorter 'getMessage' since the word 'status'
is now in the class name.

Summary of changes:
* OutputPage::getStatusMessage becomes HttpStatus::getMessage
* Method moved to the new includes/libs/HttpStatus.php
* Autoloader updated
* History kept by using 'svn copy'
* No functional changes
* No input/output format changes
* Old occurences modified in phase3
* OutputPage::getStatusMessages() marked as deprecated

PHPUnit test suite is fine.
Tested manually using a redirection
2011-07-04 21:01:19 +00:00
Sam Reed
bdf84cb20e Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
2011-06-17 16:03:52 +00:00
Tim Starling
f3f1fcdc2c * Added a REQUEST_URI check to the bug 28235 handling.
* Moved most of the bug 28235 code out to a separate library class, since I was running out of distinct function names. 
* Merged the QUERY_STRING and PATH_INFO security checks, since they are dealing with the exact same problem. Removed WebRequest::isQueryStringBad(). 
* Deal with img_auth.php by having it specify what extension it expects to be streaming out. This extension can then be compared with the extension that IE might detect.
2011-06-06 11:59:20 +00:00
Brion Vibber
5feb09f086 * (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.
2011-05-10 20:14:30 +00:00
Max Semenik
f7c1ecc5ee Removed JavaScriptDistiller: unused 2011-04-19 10:13:25 +00:00
Sam Reed
a6569e0294 * (bug 28586) YAML: strings that are the same as boolean literals
* (bug 28591) Update/replace/supplement spyc (YAML parsing library)
* YAML API output is now 1.2 compliant, using JSON as the formatter

YAML 1.2 spec is a JSON subset - "The primary objective of this revision is to bring YAML into compliance with JSON as an official subset. YAML 1.2 is compatible with 1.1 for most practical applications - this is a minor revision." [1] Per discussion with Tim, switch YAML to use the JSON formatter

Was originally going to delete the ApiFormatYaml per Tim, but class needed to keep nicer (and apparent) output in API help page

Hence made subclass ApiFormatJson, minimal method overriding

spyc.php deleted from libs

[1] http://www.yaml.org/spec/1.2/spec.html#id2803629
2011-04-18 11:42:44 +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
Ryan Kaldari
55fc4f6a86 oops, don't delete char before the slash, followup to r83902 2011-03-15 02:03:01 +00:00
Ryan Kaldari
754e09b59b keep double slash filter from breaking absolute URLs, fix to r83902 2011-03-15 01:57:37 +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
797544d3a3 (bug 27052) CSSMin generated URLs like foo//../bar in some cases, which apparently resolves to foo/bar rather than foo/../bar or bar . Fixed by eliminating duplicate slashes from the file URL when remapping 2011-03-14 15:01:50 +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
Roan Kattouw
97a945864a (bug 27328) Redo r82218 properly, expanding URLs with absolute paths 2011-02-19 14:58:16 +00:00
Roan Kattouw
a99d1f47e5 Revert r82218 , doesn't fix absolute path URLs but breaks them. Will fix properly in next commit 2011-02-19 14:46:49 +00:00
Roan Kattouw
5504fabee6 Remove comment that makes no sense post r82399 2011-02-18 14:21:52 +00:00
Tim Starling
707fe29c39 Fix comments and whitespace for \\\\ . 2011-02-18 14:18:26 +00:00