Topic on Project:Support desk

broken resourceLoader response after update to 1.21

5
Steviex2 (talkcontribs)

After an update from 1.19.6 to 1.21.0rc5 I temporary can't reach an JavaScript object defined in a resourceLoader module via inline script:

The object comes in with "ext.psladmincenter.top":

mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","ext.psladmincenterGlobal","ext.psladmincenter.top.effects","ext.psladmincenter.darkcg","ext.psladmincenter.jqgrid","ext.psladmincenter.top"]);

The error:

SCRIPT5007: Für die Eigenschaft "pslAcGridInit" kann kein Wert abgerufen werden: Das Objekt ist Null oder undefiniert

Curiously If I turn on "$wgResourceLoaderDebug" it works like before. What is the difference here?

It seems its a question of runtinme timing. What can I do? I need that inline script reference.

c u stevie

Ciencia Al Poder (talkcontribs)

Given the name of the variable (pslAcGridInit) and the extensions it's loading (ext.psladmincenter.*) it looks like a problem with that extension.

If that extension wasn't created thinking of Resource Loader, you may need to adapt it following ResourceLoader/Migration guide for extension developers

Steviex2 (talkcontribs)

The extension was developed by me with resourceLoader in mind and works in prior version without this bug since a long time. It seems that the top mdules are not fast enough loaded to reference objects initiated in such a top module with an inline "$(document).ready" - if I turn off resousourceLoaderDebug. The question is what makes the difference here.

Any ideas?

Thank you

Ciencia Al Poder (talkcontribs)

Bringing User:Krinkle attention to this.

Turning on the debug makes each module to load each file in a separate request, so it may introduce a delay and causing the missing dependency to load before it's needed.

Steviex2 (talkcontribs)

Ah okay Krinkle- that's an answer. What can I do to avoid the effect while running $wgResourceLoaderDebug in "off-mode"? Are there any tricks available? Can I influence the loading order and load my module before "mediawiki.page.startup" and "mediawiki.legacy.wikibits" as first module? Should I extend the scope of the object to window.*?

Thank you very mutch.

Reply to "broken resourceLoader response after update to 1.21"