* (bug 31187) Fix for user JavaScript validation to allow identifiers with valid...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 27 Sep 2011 22:51:36 +0000 (22:51 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 27 Sep 2011 22:51:36 +0000 (22:51 +0000)
commit72ba305da444843e31360dd445d805ccf04b9dd3
tree46aec1ff6548b7203835bbaf51b52bfd58b508b7
parent1aed95261ccd5f0012e8a26c96217b0c45001c93
* (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)
includes/libs/jsminplus.php
tests/phpunit/includes/libs/JavaScriptMinifierTest.php
tests/qunit/index.html
tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js [new file with mode: 0644]