From: Timo Tijhof Date: Wed, 6 Aug 2014 15:54:22 +0000 (+0000) Subject: resourceloader: Wrap only=script responses in "if(window.mw)" X-Git-Tag: 1.31.0-rc.0~14463^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=9272bc6c472122548199865c5175185bdaa469c3;p=lhc%2Fweb%2Fwiklou.git resourceloader: Wrap only=script responses in "if(window.mw)" We currently have a few legacy requests to the load.php end point that bypass the ResourceLoader client by coding a request to load.php via a " + ' ' ), // Load module script with with ESI @@ -186,10 +184,6 @@ mw.loader.implement("test.quux",function($,jQuery){mw.test.baz({token:123});},{" 'wgLoadScript' => 'http://127.0.0.1:8080/w/load.php', // Affects whether CDATA is inserted 'wgWellFormedXml' => false, - // Cache key is based on database name, and affects output; - // this test should not touch the database anyways. - 'wgDBname' => 'wiki', - 'wgDBprefix' => '', ) ); $class = new ReflectionClass( 'OutputPage' ); $method = $class->getMethod( 'makeResourceLoaderLink' ); @@ -219,6 +213,8 @@ mw.loader.implement("test.quux",function($,jQuery){mw.test.baz({token:123});},{" )), ) ); $links = $method->invokeArgs( $out, $args ); - $this->assertEquals( $expectedHtml, $links['html'] ); + // Strip comments to avoid variation due to wgDBname in WikiID and cache key + $actualHtml = preg_replace( '#/\*[^*]+\*/#', '', $links['html'] ); + $this->assertEquals( $expectedHtml, $actualHtml ); } }