Last modified: 2013-10-09 18:03:44 UTC
This is a followup for bug 30074. I think it would be better if the result of using "action=raw&ctype=text/javascript" or "action=raw&ctype=text/css" were changed to output nothing (or just an informative comment) if the target page is a redirect. This way the users who import a page which was moved will not have broken scripts and stylesheets. Would that be feasible by some change similar to r94155 ?
I'm pretty sure that would still by definition break their scripts/styles by removing them...?
At least it wouldn't cause syntax errors as currently happens, breaking other scripts as well.
Syntax errors shouldn't be breaking other scripts unless they're being bundled together in ResourceLoader and somebody disabled the JS validity checks. If they're coming from action=raw, then they're not going through ResourceLoader's bundling at all -- so a failure should only halt execution of that script, not any others. An error message on your JS console will however alert you to the presence of an error, won't it? Seems like it would be useful for helping people to find their broken scripts.
(In reply to comment #2) >...breaking other scripts as well. Er.. I just checked this with a code like the following on my /common.js mw.loader.load( 'http://localhost/mw18/index.php?title=MediaWiki:Test1.js&action=raw&ctype=text/javascript' ); mw.loader.load( 'http://localhost/mw18/index.php?title=MediaWiki:Test2.js&action=raw&ctype=text/javascript' ); and then moving "MediaWiki:Test1.js" to another name. As you explained, this didn't break "MediaWiki:Test2.js", so never mind...
(In reply to comment #1) > I'm pretty sure that would still by definition break their scripts/styles by > removing them...? Why not actually making redirects work in css and js pages? Is there anything that makes this fundamentally more complicated than other cases? By now we're using redirects for pages, images, templates, and it all works seamlessly.
(In reply to comment #5) > Why not actually making redirects work in css and js pages? Is there anything > that makes this fundamentally more complicated than other cases? By now we're > using redirects for pages, images, templates, and it all works seamlessly. +1. I've openned bug 33973 requesting that.
Example urls: * https://en.wikipedia.org/w/index.php?title=MediaWiki:Doesnteixst.css&action=raw&ctype=text/css * https://en.wikipedia.org/w/index.php?title=User:Krinkle/Doesnteixst.js&action=raw&ctype=text/javascript (In reply to comment #5) > (In reply to comment #1) > > I'm pretty sure that would still by definition break their scripts/styles by > > removing them...? > > Why not actually making redirects work in css and js pages? Is there anything > that makes this fundamentally more complicated than other cases? By now we're > using redirects for pages, images, templates, and it all works seamlessly. Because contrary to all of the above, CSS and javascript are not Wiki-specific objects. They are native scripts interpreted by the browser - while at the same time being an ordinary wikipage that should be editable, watchable, and... redirectable (when viewing normally). I've wontfixed bug 33973 (see reason there), and re-opening this one. We should make action=raw respond with valid CSS or JavaScript when requesting ctype=text/css or ctype=text/javascript on a redirect. Just like we used to do for non-existent ones (by reponding with HTTP 200 OK; Content: /* Empty */; - instead of HTTP 404 Not Found). For redirects we can do something like HTTP 200 OK: Content: /* Redirect */ It is important that this only happens for those content types. In other cases it should respond with the original wikitext as expected, as other wise it could break bots and scripts.
(In reply to comment #7) > For redirects we can do something like HTTP 200 OK: Content: /* Redirect */ In that case, make sure the "Redirect" text is in site language (as in bug 28937).