resourceloader: Async all the way
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 28 Jul 2015 02:46:00 +0000 (19:46 -0700)
committerOri Livneh <ori@wikimedia.org>
Tue, 4 Aug 2015 17:20:10 +0000 (10:20 -0700)
commitd7905627fdc3b210a4f42d2ba23a337d0ca2bc5c
tree7151db65be288016bc1c68eca4530f433ff091c7
parenteade3aedf59b8263849d07d4d2f99d237a4c93f4
resourceloader: Async all the way

Page startup:
* Due to the startup module and top queue being asynchronous now,
  move client-nojs/client-js class handling to OutputPage to ensure
  there is no flashes of wrongly styled or unstyled content.

  To preserve compatibility for unsupported browsers, undo the
  class swap at runtime after the isCompatible() check.

ResourceLoader startup module:
* Load the startup module with <script async>.
* Use DOM methods instead of 'document.write' to create base module request (jquery|mediawiki).

mw.loader:
* Drop 'async' parameter from mw.loader.load().
* Remove the now-unused code paths for synchronous requests.

OutputPage:

* Drop '$loadCall' parameter from makeResourceLoaderLink().
  Asynchronous is now the default and only way to load JavaScript.
  This means the 'user' module "conditional document-write scripts"
  are now a simple "mw.loader.load( url )" call.

* Fix incorrect @return of makeResourceLoaderLink(). This returns
  an array not a string.

* Improve documentation of makeResourceLoaderLink().

* Drop '$inHead' parameter from getScriptsForBottomQueue(). No longer used.
  Compatibility with the $wgResourceLoaderExperimentalAsyncLoading
  feature is maintained. It just no longer needs to change the
  way the queue works since it's always asynchronous. The feature
  flag now only controls whether the bottom queue starts at the bottom
  or starts at the top.

* Remove jQuery.ready() optimisation.
  This was mostly there to avoid the setTimeout() loop jQuery does to detect
  dom-ready in IE6/IE7 (which we no longer serve JavaScript at all).
  And for a bug in Firefox with document.write (which is no longer used as of
  this commit).

Bug: T107399
Change-Id: Icba6d7a87b239bf127a221bc6bc432cfa71a4a72
includes/OutputPage.php
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/specials/SpecialJavaScriptTest.php
resources/src/mediawiki.page/mediawiki.page.patrol.ajax.js
resources/src/mediawiki.page/mediawiki.page.startup.js
resources/src/mediawiki.page/mediawiki.page.watch.ajax.js
resources/src/mediawiki/mediawiki.js
resources/src/startup.js
tests/phpunit/includes/OutputPageTest.php