Some of you may have found that ResourceLoader's bundled & minified JavaScript loads can be a bit frustrating when syntax errors creep into your JavaScript code -- not only are the line numbers reported in your browser of limited help, but a broken file can cause *all* JS modules loaded in the same request to fail[1]. This can manifest as for instance a jquery-using Gadget breaking the initial load of jquery itself because it gets bundled together into the same request.
I've taken a copy of JSMin+ (MPL 1.1/GPL 2.0/LGPL 2.1 triple-license) to our includes/libs -- it's a JS minification library that had originally gotten knocked out of the running for merging due to being a bit slow, but has the advantage of coming with an actual JavaScript parser [2].
Only the parser is being used right now, in two places: - on the JavaScriptMinifier test cases to confirm that results are valid JS (should be extended to a fuzz tester, probably) - on each individual file loaded via ResourceLoaderFileModule or ResourceLoaderWikiModule, so we can throw a JavaScript exception with details of the parse error *with line numbers for the original input file*
This can be disabled by turning off $wgResourceLoaderValidateJs, but I'm setting it on by default to aid testing.
I'd like for folks to keep an eye out to make sure they don't get any false positive parse errors in real-world modules, and to see if there are any noticeable performance regressions. Like ResourceLoader's minification itself the validation parses are cached so shouldn't cause too much ongoing load, but it still takes some time.
[1] https://bugzilla.wikimedia.org/show_bug.cgi?id=28626 [2] http://crisp.tweakblogs.net/blog/1856/jsmin+-version-13.html
-- brion