From 9272bc6c472122548199865c5175185bdaa469c3 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 6 Aug 2014 15:54:22 +0000 Subject: [PATCH] resourceloader: Wrap only=script responses in "if(window.mw)" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 ); } } -- 2.20.1