ResourceLoader: Add an experimental option to move the main module loading queue...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 5 Jan 2012 23:32:41 +0000 (23:32 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 5 Jan 2012 23:32:41 +0000 (23:32 +0000)
commit7d5e3c070384c1d25a7de97e05b6829e127bbd85
treef602bf2f2d2e29e408a3cdb813cb590c6a7c50cb
parentf9173cb902cac38f75bf6525e0f8d861d50de8cc
ResourceLoader: Add an experimental option to move the main module loading queue (the bottom queue) from the bottom of the <body> up into the <head> , while still being loaded asynchronously. This makes them load earlier, which should make the page load faster. This is the product of a long discussion on bug 27488

* Added a "blocking" state to mw.loader . When loading scripts while the document is not ready, the loader will use document.write() if blocking is true, and append to the <body> or the <head> if blocking is false. If the document is ready, the loader will always append to the <body>
* Enable blocking mode while loading the top queue, and disable it after. This ensures that modules in the top queue are still loaded in a blocking way as they were before
* If $wgResourceLoaderExperimentalAsyncLoading is true, the bottom queue is also loaded in the head, but with blocking mode disabled. Otherwise, it's loaded at the bottom of the <body> as before
* scripts-only and messages-only requests need special treatment:
** in the top queue, they can continue to use <script src="..."> tags because they are blocking
** if the bottom queue is at the bottom of the <body> (experimental async loading disabled), they can continue to use <script src="..."> tags as before
** if the bottom queue is in the <head> (experimental async loading enabled), they cannot use <script src="..."> tags, because those would block. Instead, call mw.loader.load() on the load.php URL
includes/DefaultSettings.php
includes/OutputPage.php
resources/mediawiki/mediawiki.js