OutputPage: Ensure setupSkinUserCss() always applies to headElement()
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 30 Aug 2016 23:36:28 +0000 (16:36 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 3 Sep 2016 18:38:49 +0000 (18:38 +0000)
Follows-up 80e5b160e0, which had to move this call out of the
headElement() and buildCssLinks() methods as it was no longer
allowed to modify the module queue after it was created.

It was moved to OutputPage::output(), right before Skin::outputPage()
is called, which ends up calling headElement().

The point in time was effectively unchanged for page views.

However for the caller in ApiParse() this meant setupSkinUserCss()
no longer got called at all as it never calls output(), but instead
calls headElement() directly.

Move it to getRlClient(), which is where we set all other
OutputPage-specific things relating to module loading already.

* For page views this has no impact.
* For ApiParse it means headElement(), which calls getRlClient(),
  will once again include skin stylesheets.

Bug: T144301
Change-Id: I5fd4a27fb2d70b98ce9161dc050788d8ac364110

includes/OutputPage.php

index 1083687..5aaa474 100644 (file)
@@ -2303,7 +2303,6 @@ class OutputPage extends ContextSource {
                        // Hook that allows last minute changes to the output page, e.g.
                        // adding of CSS or Javascript by extensions.
                        Hooks::run( 'BeforePageDisplay', [ &$this, &$sk ] );
-                       $this->getSkin()->setupSkinUserCss( $this );
 
                        try {
                                $sk->outputPage();
@@ -2675,6 +2674,7 @@ class OutputPage extends ContextSource {
                                'user.styles',
                                'user.cssprefs',
                        ] );
+                       $this->getSkin()->setupSkinUserCss( $this );
 
                        // Prepare exempt modules for buildExemptModules()
                        $exemptGroups = [ 'site' => [], 'noscript' => [], 'private' => [], 'user' => [] ];