Page MenuHomePhabricator

Loading modules with a relative remote base path broken in debug mode
Closed, ResolvedPublic

Description

Something is wrong with the resource loader. Tabs are broken in Special:Preferences when resource loader is in debug mode, but not when debug mode is off.

I haven't examined it yet, but it's one of three things:

  • The code isn't being loaded in debug mode
  • Something broken in debug mode is stopping the code from executing
  • Something broke whatever event is being used in debug mode

Version: 1.18.x
Severity: normal
URL: http://translatewiki.net/wiki/Special:Preferences?debug=0

Details

Reference
bz27321

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:24 PM
bzimport set Reference to bz27321.

reachouttothetruth wrote:

The search box, the editing toolbar, and probably other JavaScript stuff is also broken in debug mode. I tried hunting this down yesterday, but failed to discover the origin of the problem. I'll keep looking.

I'll take a peek; I was poking at prefs recently.

Not related to preference script. in trunk no javascript is loaded at all except for jquery and the module implementation calls.

The script that adds the individual <script> tags (mw.loader.load('/w/resources....') is not adding the tags.

Created attachment 8130
Provisional fix to mediawiki.load

This fixes it for me, but I'm not sure it's the correct fix.

In debug mode, the loader chunks get replaced with attempts to load the specific URLs; however only module "names" beginning with 'http:' or 'https:' actually get loaded this way. Since we were receiving local urls like this:

mediaWiki.loader.implement("mediawiki.legacy.mwsuggest", function( $, mw ) {

mediaWiki.loader.load("/trunk/skins/common/mwsuggest.js");

they were getting added to a modules list and then just never work.

Checking also for module "names" that start with "/" and loading them as local URLs appears to work, but I'm not sure if it's wise. Should full URLs be used instead?

Attached:

Bug caused by regression in r81731; added a note on code review there to check whether reverting that or adding this is better fix.

Changing summary of the bug to reflect the issue.

Checking the live site I see that resources from mediawiki.legacy and extensions are loaded fine, even in debug mode. Because those have $wgStylePath and $wgExtensionAssetsPath in front of them which, in case of Wikimedia, starts with http:// (http://bits.wikimedia.org/ ...etc. )

Since resources could point to a full url prefixing wgServer in all cases is not good. So Brion's suggestion in Code Review comments: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/81731#c14121 sounds like a good idea.

(changing assignee so I can easily find a bugs if I know that I fixed them with BugZilla's search engine)

  • Bug 27372 has been marked as a duplicate of this bug. ***
  • Bug 27322 has been marked as a duplicate of this bug. ***