From aae8314279576b9638623dbf31d652c52d93ce07 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 4 May 2014 16:46:16 +0200 Subject: [PATCH] resourceloader: Report problematic modules in only=styles as well Similar to how we do with other exceptions that we don't log on the server but want a client to be able to debug, report modules that were not included in the response. Especially when debugging a load.php?only=styles request that contains lots of different modules., there was no way of knowing certain modules were excluded (e.g. because they aren't registered), other than to try and remove them from the request one by one until you're left with non-zero modules in the request and an empty string as response body. This change prepends a comment like the following to the response. /* Problematic modules: { "foo": "missing" } */ Bug: 64826 Change-Id: If5136c60ff7168dac5d6cdebd487824767c0ec16 --- includes/resourceloader/ResourceLoader.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 994812bc56..d723d0edba 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -904,6 +904,12 @@ class ResourceLoader { if ( count( $states ) ) { $out .= self::makeLoaderStateScript( $states ); } + } else { + if ( count( $states ) ) { + $exceptions .= self::makeComment( + 'Problematic modules: ' . FormatJson::encode( $states, ResourceLoader::inDebugMode() ) + ); + } } if ( !$context->getDebug() ) { -- 2.20.1