Page MenuHomePhabricator

Strange warning in the log for gadgets: "OutputPage::getModuleStyles: style module should define its position explicitly"
Closed, InvalidPublic

Description

Under MW 1.26 with debug logging enabled, a strange warning appears in the log for every defined gadget with CSS:

Warning: OutputPage::getModuleStyles: style module should define its position explicitly: ext.gadget.sharing GadgetResourceLoaderModule [Called from OutputPage::getModuleStyles in /var/www/wiki/w/includes/OutputPage.php at line 621] in /var/www/wiki/w/includes/debug/MWDebug.php on line 300

This is my MediaWiki:Gadgets-definition:

== interface-gadgets ==

* picPopup[ResourceLoader|default]|picPopup.js|picPopup.css
* floatingTips[ResourceLoader|default|dependencies=jquery.tipsy]|floatingTips.js|floatingTips.css
* scroll[ResourceLoader|default]|scroll.js
* statuses[ResourceLoader]|statuses.js
* sharing[ResourceLoader|default]|sharing.js
* liveclock[ResourceLoader]|liveclock.js
* localclock[ResourceLoader]|localclock.js
* enhancednewpages[ResourceLoader]|enhancednewpages.css
* lightblue[ResourceLoader]|lightblue.css
* grayDraft[ResourceLoader]|grayDraft.js
* roundedcorners[ResourceLoader]|roundedcorners.css
* roundedTOC[ResourceLoader]|roundedTOC.css
* BKL[rights=minoredit|ResourceLoader]|bkl-check.js
* edittop[ResourceLoader]|edittop.js
* righteditlinks[ResourceLoader]|righteditlinks.css

== behaviour-gadgets ==

* DisableExternalCounters[ResourceLoader]|DisableExternalCounters.js

== cursors ==

* cursorZoom[ResourceLoader]|cursorZoom.css
* cursorLJ[ResourceLoader]|cursorLJ.css
* cursorWikipedia[ResourceLoader]|cursorWikipedia.css
* cursorDPNI[ResourceLoader]|cursorDPNI.css
* cursorTSDNE[ResourceLoader]|cursorTSDNE.css
* cursorKMLKMZ[ResourceLoader]|cursorKMLKMZ.css
* cursorYandex[ResourceLoader]|cursorYandex.css
* cursorHTTPS[ResourceLoader]|cursorHTTPS.css
* cursorED2K[ResourceLoader]|cursorED2K.css
* cursorCollection[ResourceLoader]|cursorCollection.css

== editing-gadgets ==
* edit[ResourceLoader|default|dependencies=ext.wikiEditor]|edit.js|edit.css
* tex[ResourceLoader]|tex.js
* makecard[ResourceLoader]|makecard.js
* wikifier[ResourceLoader|default]|wikifier.js
* wfTypos[ResourceLoader|dependencies=ext.gadget.wikifier]|wfTypos.js
* editsummaries[ResourceLoader|default]|editsummaries.js
* qsig[ResourceLoader]|qsig.js
* AJAXwikidiff[ResourceLoader]|AJAXwikidiff.js
* EditingAliases[ResourceLoader]|EditingAliases.js
* QuickTagsAndTemplates[ResourceLoader]|QuickTagsAndTemplates.js|QuickTagsAndTemplates.css
* HotCat[ResourceLoader|dependencies=ext.gadget.edit]|HotCat.js|HotCat.css

All gadgets use ResourceLoader. I want all of them to load at the bottom of the page, as they use to do. I have read MediaWiki docs on this matter and I don't find it useful.

Event Timeline

alex-mashin raised the priority of this task from to Needs Triage.
alex-mashin updated the task description. (Show Details)
alex-mashin subscribed.
Aklapper renamed this task from A strange warning in the log to Strange warning in the log for gadgets: "OutputPage::getModuleStyles: style module should define its position explicitly".Dec 12 2015, 1:32 PM

P.S. If I switch debug mode off, the warnings remain.

ashley subscribed.

CSS-only (gadget) modules should define the ResourceLoader module "position", i.e. top (the other alternative is bottom, but you don't want this when you have a CSS-only module, as that'll cause a "flash of unstyled content" when the CSS is being loaded). For a good example, see the English Wikipedia's various Watchlist* gadgets, such as WatchlistBase.

That being said, I don't quite get why you're seeing this warning for a gadget which seems to have no CSS, only JS. That definitely sounds like a bug or I'm missing something here.

CSS-only (gadget) modules should define the ResourceLoader module "position", i.e. top (the other alternative is bottom, but you don't want this when you have a CSS-only module, as that'll cause a "flash of unstyled content" when the CSS is being loaded). For a good example, see the English Wikipedia's various Watchlist* gadgets, such as WatchlistBase.

That being said, I don't quite get why you're seeing this warning for a gadget which seems to have no CSS, only JS. That definitely sounds like a bug or I'm missing something here.

I added top to all CSS-only gadgets and then to all gadgets that contained CSS. Neither changed anything.

After I upgraded Gadgets extension to REL1_26, the message went away, so the bug can be closed now.

Of course, this is not documented, but the limited backward compability between MediaWiki extensions and core never is.