Last modified: 2014-07-11 23:45:11 UTC
'mw.MwEmbedSupport.style' is injected unconditionally into all pages. There's a TODO in MwEmbedSupport.hooks.php for loading it only when it is needed. It is a proper bug, IMO, since it exacts a nontrivial toll on page performance and bandwidth.
Given ResourceLoader, this should be pretty easy, right?
(In reply to comment #1) > Given ResourceLoader, this should be pretty easy, right? The difficulty is correctly identified in a comment in TimedMediaHandler.hooks.php: // We should probably move this script output to a parser function but not working correctly in // dynamic contexts ( for example in special upload, when there is an "existing file" warning. ) In other words, it's trivial to only include the stylesheet on article pages that contain timed media, but that doesn't cover cases in which a page's content is loaded via AJAX and injected into the current page. There are probably only a few such dynamic cases. My preference -- for this and for the JavaScript payload which accompanies it -- would be to expose them by reverting the load-everywhere workaround, and then wait for the bugs to trickle in.
(In reply to comment #2) > (In reply to comment #1) > > Given ResourceLoader, this should be pretty easy, right? > > The difficulty is correctly identified in a comment in > TimedMediaHandler.hooks.php: > > // We should probably move this script output to a parser function > but > not working correctly in > // dynamic contexts ( for example in special upload, when there is an > "existing file" warning. ) > > In other words, it's trivial to only include the stylesheet on article pages > that contain timed media, but that doesn't cover cases in which a page's > content is loaded via AJAX and injected into the current page. There are > probably only a few such dynamic cases. My preference -- for this and for the > JavaScript payload which accompanies it -- would be to expose them by > reverting > the load-everywhere workaround, and then wait for the bugs to trickle in. Special:upload would be the main example. Also possible when fetching file desc from commons on a foreign image (if for example desc includes video but image isn't one)
(In reply to Ori Livneh from comment #2) > My preference -- for this and for > the JavaScript payload which accompanies it -- would be to expose them by > reverting the load-everywhere workaround, and then wait for the bugs to > trickle in. Sounds sensible.
The fix should take care of the clear cases up front (e.g. categories, Special:ListFiles, Special:Upload (the one flagged in the comment itself), Special:UploadWizard). Any remaining ones that can't be thought of up front can be caught like that.
This was resolved by the fixes for bug 55550, no?
It looks like it's no longer being loaded unconditionally; see https://gerrit.wikimedia.org/r/#/c/145584/2/MwEmbedSupport.hooks.php