https://bugzilla.wikimedia.org/show_bug.cgi?id=62602

--- Comment #15 from Ori Livneh <o...@wikimedia.org> ---
From <https://gerrit.wikimedia.org/r/127457> again:

---
Timo, the reason for position => top is to be found in
OutputPage::getHeadScripts. To ensure the module version is always up-to-date,
the load.php link must be generated in PHP (rather than JavaScript, which
depends on the version set in the startup module). And getHeadScripts will only
generate links for modules in the bottom load queue if 
$wgResourceLoaderExperimentalAsyncLoading is set.
IMO, the proper way to fix this is to make getHeadScripts generate an inline
mw.loader#register script in <head> just below the startup module for all
private / user modules. It would override the version set in the startup
module, which would allow us to let JavaScript code construct the load.php
URLs.
(This is already kinda happening: if you update the user JS you'll notice that
the version for the user module in the startup module takes the usual time to
update but that doesn't matter because the load.php URL changes instantly to
reference the correct version. Though we might simply want to modify
ResourceLoaderStartupModule so that it doesn't register private / user modules
at all.)
@Legoktm: I thought I would be OK with merging this because I figured that the
only issue posed by position => top would be a performance hit, and I am
confident we can mitigate it using the strategy I described above. But there's
a bigger worry, which is that when we switch these modules to the bottom queue
a whole bunch of global scripts could break.
I think we can use MassMessage as a test-case before modifying core. So what I
would suggest is this: add a new ResourceLoaderModule subclass called something
like 'ResourceLoaderUncachedRegistrationModule'. Set its group to 'private' and
its position to 'top', so that it gets inlined. The module's getScript function
should consist of a call to ResourceLoader::makeLoaderRegisterScript(
'ext.globalCssJs.user' ).
This would mean that even if the version of the ext.globalCssJs.user module
specified in the startup module is stale, it would get overridden by the
correct version in the inline script just below. You would still be setting
group => user on ext.globalCssJs.user, but not position => top.
---

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to