HomePhabricator

resourceloader: Async all the way

Authored by Krinkle.

Description

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

Details

Committed
oriAug 4 2015, 5:20 PM
Parents
rMWeade3aedf59b: Sync up with Parsoid parserTests.
Branches
Unknown
Tags
Unknown
ChangeId
Icba6d7a87b239bf127a221bc6bc432cfa71a4a72