On 9/9/10 12:42 AM, Jean-Marc van Leerdam
wrote:
Hi,
On 9 September 2010 09:36, Tgr<gtisza(a)gmail.com> wrote:
Roan Kattouw<roan.kattouw<at>
gmail.com> writes:
> Actually, the line number would not mean a great deal because the
> scripts would still be combined, comments frequently take up entire
> lines and the deminifier cannot account for blank lines, statements
> broken over multiple lines, or multiple statements on one line. All
> this means it's impossible to map the line number to a source line and
> file, although I agree it does map it to a statement: someone else can
> add a breakpoint at the same line of the same combined+minified output
> (provided they're also hitting the same load.php URL) and have that
> break at the exact statement the reporter got their error on.
It shouldn't be too hard to have the minification script create a line number
translation table; just delay stripping newlines until the end, and create an
index of newline positions in the original and minified versions of the code.
(You would need error offsets for that to be useful, though; I don't know which
browsers provide that.)
Why not leave line endings in place (with multiple line endings
trimmed to one)? Or are the line endings a significant part of the
minification gain?
Or just use debug mode...
The purpose of using the debug mode (a feature of ResourceLoader) is not
only to not minify the code, but also to not concatenate. The difference
in performance between debug-mode and normal mode is enormous, and
trying to find middle ground is unlikely to be fruitful.
Debug mode is useful, we should be embracing the concept and improving
on it, rather than sacrificing the speed of the web-site as hundreds of
millions of people experience it, just to appease lazy developers who
don't want to type debug=true at the end of a URL.
- Trevor
Why not making this set-able through cookies?
below:
$this->debug = $request->getVal( 'debug' ) === 'true' ||
$request->getBool( 'debug' );
add something like:
if (!$this->debug)
{
$cookieval = $request-> getCookie( 'debug',
'resource_loader_',
false);
$this->debug = (!empty($cookieval));
}
This would allow developers add debugging bookmark like this:
javascript:alert(document.cookie="resource_loader_debug=1;%20path=/")
Regards,
Nux.
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org