Page MenuHomePhabricator

FlaggedRevs main (system) JavaScript variables suddenly at the end of the head tag, after MediaWiki:Common.js etc.; breaks scripts
Closed, ResolvedPublic

Description

Author: Wiki.Melancholie

Description:
Main (system) JavaScript variables suddenly at the end of the head tag, after MediaWiki:Common.js etc.
This recent change (occured with code update today) breaks efficient scripts that rely on variables like wgStableRevisionId on runtime/loadtime!

Example:
<script type="text/javascript">
var wgFlaggedRevsParams = {"tags": {"accuracy": 2}};
var wgStableRevisionId = 1068025;
var wgAjaxReview = {"sendingMsg": "Übertragung …", "sentMsgOk": "Markierung gesetzt ✔", "sentMsgBad": "Markierung konnte nicht gesetzt werden!", "actioncomplete": "Aktion beendet", "actionfailed": "Aktion fehlgeschlagen"}
</script>
<script type="text/javascript" src="/w/extensions/FlaggedRevs/flaggedrevs.js?60"></script>
</head>


Version: unspecified
Severity: enhancement
URL: http://de.wiktionary.org/wiki/Tor

Details

Reference
bz20690

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:53 PM
bzimport set Reference to bz20690.

Wiki.Melancholie wrote:

Variables: place them in front of the wikibits.js inclusion, they should at least be available for gadgets and following scripts.

Something in OutputPage.php changed the order it seems.

We chatted briefly on this in IRC; current recommendation is to move the vars into the MakeGlobalVariablesScript hook so they'll show up in the main variable block, which is guaranteed to come before other JS inclusions.

Wiki.Melancholie wrote:

Not quite sure, but shouldn't the line

<script type="text/javascript"
src="/w/extensions/FlaggedRevs/flaggedrevs.js?60"></script>

come directly after the core scripts? At the moment it comes last (</head>); maybe there is a reason for this, but if not it should be grouped with all the other core & extension scripts (like centralnotice.js e.g.).

See also bug 20720 ("Change script loading order back")