Gadgets that use both scripts and styles, but do not specify type=general, are never loaded (JS file not loaded but CSS file is)
Closed, ResolvedPublic

Description

Multiple users have reported that since 10 May 2017, the cat-a-lot gadget fails to appear in their browsers. Appears to affect all platforms with no connection to an external update, say of java or browsers. Possibly something like a css change may have removed the relevant hook.

Fae created this task.May 11 2017, 12:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 11 2017, 12:08 PM
Fae updated the task description. (Show Details)May 11 2017, 12:14 PM

Hi @Fae, thanks for taking the time to report this! In general, please provide steps how to reproduce a problem.

I assume in this case:

Expected result:

  • See a yellow item in the lower right corner

Actual result:

  • Nothing displayed in that corner

Some basic debugging:
Going to https://commons.wikimedia.org/wiki/Category:Oakland_vehicles?debug=true and opening the 'network' tab of the web browser's developer tools, there is a single entry about
https://commons.wikimedia.org/w/load.php?debug=true&lang=en&modules=ext.gadget.Cat-a-lot&only=styles&skin=vector
(loaded as type "stylesheet / css") but I don't see any entry for a Cat-a-lot file with "script / js".
Both a .js and a .css file are listed in https://commons.wikimedia.org/wiki/MediaWiki:Gadgets-definition#Categories

Also, the gadget "Cat-a-lot" styles are loaded twice and should be migrated to type=general (see https://www.mediawiki.org/wiki/RL/MGU#Gadget_type ); not sure if that is related though.

Aklapper renamed this task from cat-a-lot gadget fails to appear to Cat-a-Lot gadget on Commons fails to appear (JS file not loaded but CSS file is).May 11 2017, 1:07 PM
Jdx added a subscriber: Jdx.May 11 2017, 1:32 PM

@Aklapper This is not only cat-a-lot, Navigation popups also doesn't work. Wasn't MediaWiki on Commons updated yesterday? Anyway, without popups reverting vandalisms is a torture…

My guess is that it is linked to T122755

matmarex added subscribers: Krinkle, matmarex.

The page source includes the following call for me, which is normally used for style-only modules to indicate that their CSS is loaded and should not be loaded again. For some reason 'ext.gadget.Cat-a-lot' is among them, and so it is not being loaded. This obviously makes no sense, and I have no idea what could be causing this.

I suspect setting it to 'type=general' should resolve the problem (since then it won't be loaded as style-only), but we might have other gadgets with this problem on other wikis. There's definitely a MediaWiki bug here.

mw.loader.state({"ext.gadget.Long-Image-Names-in-Categories":"ready","ext.gadget.Cat-a-lot":"ready","ext.globalCssJs.user.styles":"ready","ext.globalCssJs.site.styles":"ready","site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"loading","user.tokens":"loading","mediawiki.action.view.categoryPage.styles":"ready","ext.categoryTree.css":"ready","mediawiki.page.gallery.styles":"ready","mediawiki.helplink":"ready","wikibase.client.init":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.echo.styles.badge":"ready","ext.echo.badgeicons":"ready","ext.uls.pt":"ready","ext.wikimediaBadges":"ready","ext.tmh.thumbnail.styles":"ready","mediawiki.legacy.shared":"ready","mediawiki.legacy.commonPrint":"ready","mediawiki.sectionAnchor":"ready","mediawiki.skinning.interface":"ready","skins.vector.styles":"ready","ext.globalCssJs.user":"loading","ext.globalCssJs.site":"ready"});

I applied this change to fix those important scripts on Commons (Cat-a-lot and Navigation Popups): https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=243659552&oldid=242815770

There is still a MediaWiki bug here and it should be resolved before this change is deployed further (otherwise we'll have the same problem with all Wikipedias in a couple hours).

matmarex renamed this task from Cat-a-Lot gadget on Commons fails to appear (JS file not loaded but CSS file is) to Gadgets that use both scripts and styles, but do not specify type=general, are never loaded (JS file not loaded but CSS file is).May 11 2017, 4:56 PM
matmarex triaged this task as High priority.

Change 353333 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/extensions/Gadgets@master] Revert "Move gadget styles from main stylesheet request to site request"

https://gerrit.wikimedia.org/r/353333

Change 353335 had a related patch set uploaded (by Krinkle; owner: Legoktm):
[mediawiki/extensions/Gadgets@wmf/1.30.0-wmf.1] Revert "Move gadget styles from main stylesheet request to site request"

https://gerrit.wikimedia.org/r/353335

Change 353333 merged by jenkins-bot:
[mediawiki/extensions/Gadgets@master] Revert "Move gadget styles from main stylesheet request to site request"

https://gerrit.wikimedia.org/r/353333

Krinkle closed this task as Resolved.May 11 2017, 5:46 PM
Krinkle claimed this task.

This is a regression from 86905f8d78afaea2f5 because it added getGroup: 'site' which, I forgot, also has a special meaning in OutputPage::getRlClient. The special meaning being that it is assumed that if a module is loaded with addModuleStyles() and has group=site, it can safely be assumed as fully loaded thereafter.

This avoids bugs with styles loading twice, but also means that gadgets trying to do both don't get their JS parts loaded. This is wrong of course, and if anything, after T92459 is solved, the assumption will be made the other way around (gadgets containing both will be assumed 'general', they are not assumed 'styles' only, which didn't make sense).

The reason styles-only was wrongly assumed is because the Gadgets extension unconditionally loads the module styles, once with addModuleStyles, which itself is also a bug, but we're waiting for community migration to finish before we can fully resolve that.

Change 353335 merged by jenkins-bot:
[mediawiki/extensions/Gadgets@wmf/1.30.0-wmf.1] Revert "Move gadget styles from main stylesheet request to site request"

https://gerrit.wikimedia.org/r/353335

Stashbot added a subscriber: Stashbot.

Mentioned in SAL (#wikimedia-operations) [2017-05-11T18:53:05Z] <thcipriani@tin> Synchronized php-1.30.0-wmf.1/extensions/Gadgets/includes/GadgetResourceLoaderModule.php: SWAT: [[gerrit:353335|Revert "Move gadget styles from main stylesheet request to site request"]] T165040 T165031 (duration: 00m 42s)