wiki.techinc.nl/includes/resourceloader
Brion Vibber 0f201b19f4 * (bug 28626) Validate JavaScript files and pages loaded via ResourceLoader before minification, protecting separate modules from interference
This is possibly not perfect but seems to serve for a start; follows up on r91591 that adds JSMin+ to use it in some unit tests. May want to adjust some related bits.

- $wgResourceLoaderValidateJs on by default (can be disabled)
- when loading a JS file through ResourceLoaderFileModule or ResourceLoaderWikiModule, parse it using JSMinPlus's JSParser class. If the parser throws an exception, the JS code of the offending file will be replaced by a JS exception throw listing the file or page name, line number (in original form), and description of the error from the parser.
- parsing results are cached based on md5 of content to avoid re-parsing identical text
- for JS pages loaded via direct load.php request, the parse error is thrown and visible in the JS console/error log

Issues:
- the primary use case for this is when a single load.php request implements multiple modules via mw.loader.implement() -- the loader catches the exception and skips on to the next module (good) but doesn't re-throw the exception for the JS console. It does log to console if present, but it'll only show up as a regular debug message, not an error. This can suppress visibility of errors in a module that's loaded together with other modules (such as a gadget).
- have not done performance testing on the JSParser
- have not done thorough unit testing with the JSParser
2011-07-06 21:48:09 +00:00
..
ResourceLoader.php Swap else if for elseif 2011-06-17 16:05:05 +00:00
ResourceLoaderContext.php (bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionality (and dependent wfUILang) in core, as most or all work is finished. 2011-07-06 02:26:06 +00:00
ResourceLoaderFileModule.php * (bug 28626) Validate JavaScript files and pages loaded via ResourceLoader before minification, protecting separate modules from interference 2011-07-06 21:48:09 +00:00
ResourceLoaderFilePageModule.php (bug 29277) MediaWiki:Filepage.css not loaded on foreignwiki itself. Fixup to r68904. Yay Roan finally taught me how to use the resourceloader :D 2011-06-29 00:08:25 +00:00
ResourceLoaderModule.php * (bug 28626) Validate JavaScript files and pages loaded via ResourceLoader before minification, protecting separate modules from interference 2011-07-06 21:48:09 +00:00
ResourceLoaderNoscriptModule.php Fixup/add documentation 2011-05-21 17:45:20 +00:00
ResourceLoaderSiteModule.php Fixup/add documentation 2011-05-21 17:45:20 +00:00
ResourceLoaderStartUpModule.php Swap else if for elseif 2011-06-17 16:05:05 +00:00
ResourceLoaderUserGroupsModule.php Fixup/add documentation 2011-05-21 17:45:20 +00:00
ResourceLoaderUserModule.php Fixup/add documentation 2011-05-21 17:45:20 +00:00
ResourceLoaderUserOptionsModule.php Fixup/add documentation 2011-05-21 17:45:20 +00:00
ResourceLoaderUserTokensModule.php Follow-up r88554: Passing null for now, fixed php error about missing arguments. 2011-05-21 23:41:41 +00:00
ResourceLoaderWikiModule.php * (bug 28626) Validate JavaScript files and pages loaded via ResourceLoader before minification, protecting separate modules from interference 2011-07-06 21:48:09 +00:00