On Wed, Jul 6, 2011 at 3:04 PM, Brion Vibber <brion(a)pobox.com> wrote:
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.
Per feedback from TranslateWiki (yay testers!) I've disabled validation for
JS modules coming from on-disk files; large libs like jQuery can hit the PHP
memory limits if you're unlucky. This kills the load.php process, neatly
defeating the purpose of validating the code. ;)
Validation is still on by default for JS modules pulled from wiki pages --
which are editable and therefore what we really cared about to begin with.
:)
May still be nice to reduce the memory footprint of the syntax tree as it's
being built, as it's likely a very inefficient structure by default. Gadgets
that stuff big JS libraries into their pages are probably the most likely to
still be able to fail this way.
-- brion