Last modified: 2013-10-09 18:03:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32074, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30074 - Redirecting css/js wiki pages shouldn't cause syntax errors when loaded as a module.
Redirecting css/js wiki pages shouldn't cause syntax errors when loaded as a ...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
unspecified
All All
: Normal normal (vote)
: 1.19.0 release
Assigned To: Roan Kattouw
https://secure.wikimedia.org/wikiped...
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-26 19:36 UTC by Helder
Modified: 2013-10-09 18:03 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Proposed fix (674 bytes, patch)
2011-08-02 00:00 UTC, John Du Hart
Details
Follow up patch (690 bytes, patch)
2011-08-02 00:06 UTC, John Du Hart
Details
Alternate method, redirect ignored in resourceloader (875 bytes, patch)
2011-08-02 02:04 UTC, John Du Hart
Details

Description Helder 2011-07-26 19:36:49 UTC
Currentlym if SomeUser moves its [[User:SomeUser/vector.js]] to [[User:SomeUser/common.js]], the vector page will receive the redirect code such as
----------------------------------------
#REDIRECT [[User:SomeUser/common.js]]
----------------------------------------
which breaks the user scripts since this is not part of JS syntax (see a real case in the provided URL).

I think it is good idea to avoid this breakage somehow, e.g.:
* Do not redirect the JS and CSS pages when moved
* Add the redirect code /* inside of a comment */ (and make it work there, if it currently doesn't)
* Add some kind of "importScript" or "mw.loader.load" function instead of a redirect, so that if a user is importing the old page it will still get the content of the script
* Some other option...
Comment 1 John Du Hart 2011-08-02 00:00:45 UTC
Created attachment 8863 [details]
Proposed fix
Comment 2 John Du Hart 2011-08-02 00:06:11 UTC
Created attachment 8864 [details]
Follow up patch

Oops, this one trims the newline off the redirect
Comment 3 Krinkle 2011-08-02 00:32:03 UTC
Commenting it out seems like a weird way of avoiding this bug, besides it leaves an invalid redirect.

Either:
* Don't allow moving without 'suppress redirect' option of css/js subpages
* Change the loader to follow redirects
* Change the loader to ignore redirects
Comment 4 John Du Hart 2011-08-02 01:54:45 UTC
(In reply to comment #3)
> Commenting it out seems like a weird way of avoiding this bug, besides it
> leaves an invalid redirect.
> 
> Either:
> * Don't allow moving without 'suppress redirect' option of css/js subpages

That no good for people who don't have the suppress redirect right, which are the people who are requesting this.
> * Change the loader to follow redirects

That sounds like a bad idea that could cause more trouble than it's worth.
> * Change the loader to ignore redirects

That might be doable, let me try it out.
Comment 5 John Du Hart 2011-08-02 02:04:01 UTC
Created attachment 8866 [details]
Alternate method, redirect ignored in resourceloader
Comment 6 Krinkle 2011-08-02 05:44:36 UTC
Assigning to Roan for review.
Comment 7 Roan Kattouw 2011-08-10 14:23:43 UTC
Fixed in r94155. Thanks for the patch.
Comment 8 db [inactive,noenotif] 2012-02-11 19:42:01 UTC
*** Bug 27509 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links