resourceloader: Move logo preload from OutputPage to SkinModule
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 20 Aug 2018 23:42:42 +0000 (00:42 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 27 Aug 2018 23:05:51 +0000 (23:05 +0000)
commit5d0b5a402e384897288ad569da8d534fa2e432cb
tree41f493f9cad53c8eade38265dd59a8a9420161e6
parente4676f42ffceae5249c4d3f02f1d43c2f2ef44e5
resourceloader: Move logo preload from OutputPage to SkinModule

This was introduced in OutputPage before support for getPreloadLinks()
was added to ResourceLoader. The introduction in ResourceLoader was
actually inspired by this original implementation.

Now that we have it, we should make use of it for this module
as well. Doing so has several benefits:

* Makes the code cleaner by not requiring every skin to implement
  the extra boolean method. Instead, it naturally works. If
  the skin loads the SkinModule, it gets the preload as well.
  If not (such as Minerva, which has a different logo config),
  then it also doesn't get the preload link.
  Naturally, automatic.

* Makes code cleaner by not having static methods, and by not
  having OutputPage call into a Module class.

* Fixes the problem where, if a site's logo is changed, all cached
  HTML is preloading the old logo whilst the stylesheet fetches
  the newer one. Causing both to be downloaded.

* Still preloads the logo well before it can render.

Change-Id: I11b390f2e4f5e7db8b4506ab547839152888005c
includes/OutputPage.php
includes/resourceloader/ResourceLoaderSkinModule.php
includes/skins/Skin.php
tests/phpunit/includes/OutputPageTest.php