Page MenuHomePhabricator

Merge <script> tags output by ResourceLoader in the 'top' and 'bottom' queues.
Closed, ResolvedPublic

Description

We currently have this in our page source:

<script>if(window.mw){ mw.config.set(...); }</script>
<script>if(window.mw){ mw.loader.load( ... ); }</script>

Seems kinda ridiculous. The config.set() call should be merged into the bottom one.


Version: 1.17.x
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:21 PM
bzimport set Reference to bz25202.
bzimport added a subscriber: Unknown Object (MLST).
Catrope created this task.Sep 17 2010, 2:47 PM

Please read the code that generates this...

http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/OutputPage.php?view=markup#l2352

You will see that while I want to combine them, Skin::makeGlobalVariablesScript returns a complete script tag, not just JavaScript code. We will need to go deeper into the treacherous depths of MediaWiki to fix this - it was outside the scope of an already huge set of changes, so I skipped it at the time.

So it's not easy to fix, that's fine then. It would still be nice to have makeGlobalVariablesScript() wrap its output in if ( mediaWiki !== undefined ) for consistency, though.

Removing dependancy on ResourceLoader 1.0 implementation.

Moving to MediaWiki/ResourceLoader category.

Not adding as a dependancy for ResourcerLoader 2.0, it's a nice to have but not a requirement.

Krinkle updated the task description. (Show Details)Nov 26 2014, 12:32 AM
Krinkle set Security to None.

Change 197096 had a related patch set uploaded (by Krinkle):
Create WrappedString class for compacting strings with the same prefix/suffix

https://gerrit.wikimedia.org/r/197096

Change 197096 abandoned by Krinkle:
Create WrappedString class for compacting strings with the same prefix/suffix

Reason:
Moved into separate lib: https://gerrit.wikimedia.org/r/#/c/227365/

https://gerrit.wikimedia.org/r/197096

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 28 2015, 10:27 PM

Change 228181 had a related patch set uploaded (by Krinkle):
resourceloader: Use WrappedString library to merge RLQ inline scripts

https://gerrit.wikimedia.org/r/228181

Change 228181 merged by jenkins-bot:
resourceloader: Use WrappedString library to merge RLQ inline scripts

https://gerrit.wikimedia.org/r/228181

Krinkle closed this task as Resolved.Aug 27 2015, 6:04 PM
Krinkle claimed this task.
Krinkle moved this task from Accepted Enhancement to Assigned on the MediaWiki-ResourceLoader board.
Krinkle removed a project: Patch-For-Review.
Krinkle removed a subscriber: wikibugs-l-list.
Restricted Application added a project: Performance-Team. · View Herald TranscriptAug 7 2018, 4:05 PM