Fix a race condition in classic edit toolbar setup
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Jan 2012 01:38:26 +0000 (01:38 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Jan 2012 01:38:26 +0000 (01:38 +0000)
commit749ebf43165b406cfee840632ac79418d637be6e
treee95b4895875060f2b3d6fb1ce263ce76c65a98bf
parente4acd105f9271ac569e5cd6e2d0e1c4f5eae00d8
Fix a race condition in classic edit toolbar setup

mediawiki.action.edit used to call mw.toolbar.init on its own during DOMReady -- this required that the module already be loaded *before* DOMReady, *and* that it be fully loaded before the immedate-execution code that sets up the default toolbar items (output from EditPage.php).
This failed since we've gone fully async in the bottom-loading items, and could result in failed calls to mw.toolbar.addButton.

Wrapped those immediate calls in a mediawiki.loader.using call to ensure they're run after the module is loaded, and moved the mw.toolbar.init call into that section so we guarantee it gets run first.
includes/EditPage.php
resources/mediawiki.action/mediawiki.action.edit.js