Last modified: 2014-08-29 02:01:15 UTC
The HTML includes lines like <script src="https://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=user.groups&skin=vector&user=John+Vandenberg&version=20131012T104928Z&*"></script> load.php returns JS which starts with mw.loader.implement("user.groups",function(){...} However object 'mw' doesnt exist when the browser fails the isCompatible test here: https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/resources%2Fstartup.js load.php should return JS which starts with if (window.mw) { mw.loader.implement("user.groups",function(){...} }
Depending on whether we work on bug 30358 first, this bug becomes moot. Personally I'd prefer that. The direct load.php requests embedded in the HTML, at least for scripts, are a hack because they bypass the client-side loader and with that the implementation logic and callback. This is why we currently output additional script tags along side these (for modules=site, user, user.groups etc.) to set the state to "loading" and/or "ready". I'd much rather fix bug 30358, and keep the model that if you make a request to load.php, unless you set raw=1, you are expected to handle mw.loader.implement. If you can't (e.g. because the browser isn't compatible and didn't get the mediawiki.loader payload) that request shouldn't be fired in the first place. - It's a wasted request. - Requires hardcoded script tags. - Requires the mw.loader.state "loading" hacks in the html. Of course, if bug 30358 takes too much to fix on the short term, we could work around it by prefixing load.php responses with `window.mw&&`, but I'd rather not as it masks errors and makes it harder to detect that the 3 points above are required by the client.
Lowering priority since these exceptions happen in a global and isolated execution scope (doesn't affect other scripts, though even if it didn't, there most likely aren't any other scripts), plus, they shouldn't be visible to non-developers anyway (except for IE which in older versions does its "This web page has an error" thing by default, though configurable).
A RessourceLoader::makeLoaderConditionalScript function exists for this and it is used in some places.
Fixed. > resourceloader: Wrap only=script responses in "if(window.mw)" > > Change-Id: Icf6ede09b51ce212aa70ff6be4b341762ec75b4d