Page MenuHomePhabricator

Turn startUp() function into a local callback for mediawiki.js in startup.js
Closed, ResolvedPublic

Description

Right now we have roughly this:

--
load.php?module=startup:

function isCompatible() {
 ..
}
function startUp() {
 ..mw.loader.register( ... );
}
if ( isCompatible() ) {
  .. script .. load.php?module=jquery|mediawiki

}

--
load.php?module=jquery|mediawiki
* jquery.js
* mediawiki.js
  - contains:
    if ( jQuery.isFunction( window.startUp ) ) {
      window.startUp();
    }

mw.loader.state({"jquery":"ready","mediawiki":"ready"});

With T107399 solved, the request for jquery|mediawiki is no longer blocking and now uses a dynamic script tag for which we can get a callback. Thus no longer needing the global function, nor for it to be manually called.

Details

Reference
bz37894

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:24 AM
bzimport set Reference to bz37894.
bzimport added a subscriber: Unknown Object (MLST).
Krinkle created this task.Jun 24 2012, 5:49 AM

mailstorpk wrote:

"mw.loader.state" needs to be called only after a valid registry is loaded.
But the registry is not necessarily loaded always as it is done through startUp function which is in an if condition (which is not necessarily true)
So, either call the startup function always before the loader.state is invoked, or replace the startUp fuction definion with the body of that fucntion itself.

This is clearly not actually assigned.

Krinkle set Security to None.
Krinkle updated the task description. (Show Details)
Krinkle removed a subscriber: Unknown Object (MLST).
Krinkle updated the task description. (Show Details)Aug 5 2015, 1:40 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 5 2015, 1:40 AM
Krinkle renamed this task from Get rid of startUp() function in mediawiki.js to Turn startUp() function into a local callback for mediawiki.js in startup.js.Aug 5 2015, 1:43 AM
Krinkle updated the task description. (Show Details)

Change 234678 had a related patch set uploaded (by Krinkle):
resourceloader: Remove global startUp() callback

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

Krinkle claimed this task.Aug 28 2015, 10:21 PM
Krinkle moved this task from Accepted: Enhancement to Assigned on the MediaWiki-ResourceLoader board.

Change 234678 merged by jenkins-bot:
resourceloader: Remove global startUp() callback

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

Krinkle closed this task as Resolved.Sep 4 2015, 2:52 AM