Last modified: 2014-06-26 23:40:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39894, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37894 - Get rid of startUp() function in mediawiki.js
Get rid of startUp() function in mediawiki.js
Status: NEW
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.17.x
All All
: Low enhancement (vote)
: Future release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-24 05:49 UTC by Krinkle
Modified: 2014-06-26 23:40 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2012-06-24 05:49:13 UTC
Right now we have roughly this:

-----------------------------------

-- load.php?module=startup

function isCompatible() {
 ..
}
function startUp() {
 ..mw.loader.register( ... );
}
if ( isCompatible() ) {
  document.write( 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"});

-----------------------------------

Since the request for jquery/mediawiki is blocking, we can just put the contents of startUp() after the load without needing the function.

This doesn't work right away though, due to the mw.loader.state() call. Because if that is called before the registry is created it will create null-modules with those names, causing an exception when the real registry is inserted.
Comment 1 roopak 2013-09-06 14:40:16 UTC
"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.
Comment 2 James Forrester 2014-06-26 23:40:20 UTC
This is clearly not actually assigned.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links