Hi all,
Last month I did a minor refactor of Parser, ApiParse, and OutputPage to better deal with module loading. Specifically to resolve T130632 ("Needless loading of mediawiki.toc on mobile views.")
* OutputPage: Hardcoded some of modules in OutputPage::output. – Moved to Skin with https://gerrit.wikimedia.org/r/354682 * Parser: Loaded 'mediawiki.toc' (via ParserOutput). – Moved to Skin with https://gerrit.wikimedia.org/r/353573 * (Other changes at [1])
Parser and OutputPage now don't load modules by default anymore. OutputPage is still where modules are added to for the output, but OutputPage itself no longer adds to this. The defaults now get added by Skin::getDefaultModules instead.
Skins now have full control over which modules to load.
ApiParse (e.g. used by VisualEditor, live preview, etc.) now has an explicit 'useskin' parameter. When set, the API will wrap the ParserOutput object in an OutputPage, and call addParserOutputMetadata() and Skin::getDefaultModules.
The result is a 'modules' property in the Parse API that much more closely resembled what a regular page view would load.
Thanks to Brad Jorsch (Anomie), Bartosz Dziewoński (MatmaRex) and Fomafix for helping me make this happen!
As part of this refactor, the OutputPage::enableTOC() was removed. It contradicted the one-way logic flow (Parser>ParserOutput>OutputPage). It was introduced in MediaWiki 1.22 for the purpose of allowing MobileFrontend to disable the default TOC. However, as we now know (T130632) that only solved the problem partially. No other callers were found in Wikimedia Git. As such, I chose not keep the exception to this logic flow.
-- Krinkle
[1] https://gerrit.wikimedia.org/r/#/q/project:mediawiki/core+topic:mwtoc+is:mer...
wikitech-l@lists.wikimedia.org