resourceloader: Remove 'user.styles' dependency from 'user' module
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 23 May 2018 14:53:33 +0000 (15:53 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 23 May 2018 14:53:33 +0000 (15:53 +0100)
Follows-up c3f200849b99721, which made isKnownEmpty() return false
for modules that have dependencies.

This had the side-effect of causing the 'user' module to be loaded
in its own HTTP request on all page views, even for logged-out users
and for registered users without scripts, because it has a dependency
on the 'user.styles' module.

This commit fixes that regression by removing the dependency so
that the 'user' module can, once again, be considered "empty".

The dependency isn't needed. It was only added for the transitional
period after the 'user' module was split up so that existing cached
views for logged-in users (in theory, e.g. 304 Not Modified) would
still trigger a load for the styles.

But that transition ended over a year ago. Now, both modules act
independently and are always queued separately, with user.styles
explicitly added as a style module (as it should be).

Even for the case of an AJAX preview (if it is somehow possible for
the 'user' module to not be loaded already), the API would respond
with a module list that contains both 'user' and 'user.styles'.

Bug: T195380
Change-Id: I9852516af1bd55c84a9213628c7796e2c2168745

includes/resourceloader/ResourceLoaderUserModule.php

index e747373..026cea1 100644 (file)
@@ -77,12 +77,4 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
        public function getGroup() {
                return 'user';
        }
-
-       /**
-        * @param ResourceLoaderContext|null $context
-        * @return array
-        */
-       public function getDependencies( ResourceLoaderContext $context = null ) {
-               return [ 'user.styles' ];
-       }
 }