resourceloader: Don't call wfExpandUrl() on load.php urls
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 15 Sep 2015 20:21:04 +0000 (21:21 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 15 Sep 2015 20:21:04 +0000 (21:21 +0100)
wfExpandUrl() should only be used if the url needs to be absolute
and/or needs to point to the canonical, internal or default wgServer
for the wiki.

For meta-data or API responses this can make sense, but for resources
loaded by the browser from the current page, there is no added value
in expanding these to the default domain.

This is causing problems in custom setups such as at Wikimedia,
with "zero" and "m" sub domains for which $wgServer points to the
canonical domain.

Bug: T106966
Bug: T112646
Change-Id: Ie25d3a8f69564319a1b29b5c5904f3d352924a31

includes/resourceloader/ResourceLoader.php

index b8ec63b..da74b35 100644 (file)
@@ -1485,7 +1485,7 @@ MESSAGE;
                $query = self::createLoaderQuery( $context, $extraQuery );
                $script = $this->getLoadScript( $source );
 
-               return wfExpandUrl( wfAppendQuery( $script, $query ), PROTO_RELATIVE );
+               return wfAppendQuery( $script, $query );
        }
 
        /**
@@ -1513,7 +1513,7 @@ MESSAGE;
                        $only, $printable, $handheld, $extraQuery
                );
 
-               return wfExpandUrl( wfAppendQuery( $wgLoadScript, $query ), PROTO_RELATIVE );
+               return wfAppendQuery( $wgLoadScript, $query );
        }
 
        /**