Page MenuHomePhabricator

ResourceLoader dependencies are not always reliable in debug mode
Closed, ResolvedPublic

Description

ResourceLoader dependencies are not always reliable in debug mode. This generally pops up when a module from the top queue depends on a module from the bottom queue, or with the custom-hacked private embedded modules. Examples from the past include T36542, T49457, T102718.

I think it all comes down to this bit in mediawiki.js, addScript() function:

document.write( mw.html.element( 'script', { 'src': src }, '' ) );
if ( callback ) {
	// Document.write is synchronous, so this is called when it's done.
	// FIXME: That's a lie. doc.write isn't actually synchronous.
	callback();
}

Like the FIXME says, document.write isn't actually synchronous, and therefore dependent modules sometimes execute before their dependencies are loaded.

Event Timeline

matmarex raised the priority of this task from to Medium.
matmarex updated the task description. (Show Details)
matmarex subscribed.
Krinkle claimed this task.
Krinkle moved this task from Backlog to Assigned on the MediaWiki-ResourceLoader board.

Solved by T107399. Thanks!