OutputPage: Don't output mw.loader.state "loading" and mw.loader.state "ready" for the same module
Closed, ResolvedPublic

Description

It looks like we currently output both for some modules.

Current output on a wiki with user and site css/js enabled[1] but empty:

<script>if(window.mw){
mw.loader.state({"site":"loading","user":"loading","user.groups":"loading"});
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.hidpi","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.page.watch.ajax","ext.vector.collapsibleNav","ext.visualEditor.viewPageTarget","skins.vector.js"],null,true);
}</script>
<script>if(window.mw){
mw.loader.state({"site":"ready"});
}</script>
<script>if(window.mw){
mw.loader.state({"user":"ready"});
}</script>
<script>if(window.mw){
mw.loader.state({"user.groups":"ready"});
}</script>

The first one with "loading" is always output. The last 3 with "ready" are output by OutputPage::makeResourceLoaderLink if $module->isKnownEmpty is true.

We should probably optimise this to just output "ready" in the first place.


Version: unspecified
Severity: enhancement

bzimport set Reference to bz50038.
Krinkle created this task.Via LegacyJun 23 2013, 8:34 AM
Umherirrender added a comment.Via ConduitAug 24 2014, 7:12 PM

This looks fixed for me, because at the moment I will get directly
mw.loader.state({"site":"ready","user":"ready","user.groups":"ready"});
when there is no site or user js page (bug 46857?).

Krinkle added a comment.Via ConduitOct 6 2014, 9:46 AM

resourceloader: Refactor module links output

Change-Id: I91754ce5fae3d05b4bfa7372372eba81ee2fc579

Add Comment