Followup r78924: keep track of exception/warning comments separately, to prevent...
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoader.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @author Roan Kattouw
20 * @author Trevor Parscal
21 */
22
23 /**
24 * Dynamic JavaScript and CSS resource loading system.
25 *
26 * Most of the documention is on the MediaWiki documentation wiki starting at:
27 * http://www.mediawiki.org/wiki/ResourceLoader
28 */
29 class ResourceLoader {
30
31 /* Protected Static Members */
32
33 /** Array: List of module name/ResourceLoaderModule object pairs */
34 protected $modules = array();
35 /** Associative array mapping module name to info associative array */
36 protected $moduleInfos = array();
37
38 /* Protected Methods */
39
40 /**
41 * Loads information stored in the database about modules.
42 *
43 * This method grabs modules dependencies from the database and updates modules
44 * objects.
45 *
46 * This is not inside the module code because it is much faster to
47 * request all of the information at once than it is to have each module
48 * requests its own information. This sacrifice of modularity yields a substantial
49 * performance improvement.
50 *
51 * @param $modules Array: List of module names to preload information for
52 * @param $context ResourceLoaderContext: Context to load the information within
53 */
54 public function preloadModuleInfo( array $modules, ResourceLoaderContext $context ) {
55 if ( !count( $modules ) ) {
56 return; // or else Database*::select() will explode, plus it's cheaper!
57 }
58 $dbr = wfGetDB( DB_SLAVE );
59 $skin = $context->getSkin();
60 $lang = $context->getLanguage();
61
62 // Get file dependency information
63 $res = $dbr->select( 'module_deps', array( 'md_module', 'md_deps' ), array(
64 'md_module' => $modules,
65 'md_skin' => $context->getSkin()
66 ), __METHOD__
67 );
68
69 // Set modules' dependencies
70 $modulesWithDeps = array();
71 foreach ( $res as $row ) {
72 $this->getModule( $row->md_module )->setFileDependencies( $skin,
73 FormatJson::decode( $row->md_deps, true )
74 );
75 $modulesWithDeps[] = $row->md_module;
76 }
77
78 // Register the absence of a dependency row too
79 foreach ( array_diff( $modules, $modulesWithDeps ) as $name ) {
80 $this->getModule( $name )->setFileDependencies( $skin, array() );
81 }
82
83 // Get message blob mtimes. Only do this for modules with messages
84 $modulesWithMessages = array();
85 foreach ( $modules as $name ) {
86 if ( count( $this->getModule( $name )->getMessages() ) ) {
87 $modulesWithMessages[] = $name;
88 }
89 }
90 $modulesWithoutMessages = array_flip( $modules ); // Will be trimmed down by the loop below
91 if ( count( $modulesWithMessages ) ) {
92 $res = $dbr->select( 'msg_resource', array( 'mr_resource', 'mr_timestamp' ), array(
93 'mr_resource' => $modulesWithMessages,
94 'mr_lang' => $lang
95 ), __METHOD__
96 );
97 foreach ( $res as $row ) {
98 $this->getModule( $row->mr_resource )->setMsgBlobMtime( $lang, $row->mr_timestamp );
99 unset( $modulesWithoutMessages[$row->mr_resource] );
100 }
101 }
102 foreach ( array_keys( $modulesWithoutMessages ) as $name ) {
103 $this->getModule( $name )->setMsgBlobMtime( $lang, 0 );
104 }
105 }
106
107 /**
108 * Runs JavaScript or CSS data through a filter, caching the filtered result for future calls.
109 *
110 * Available filters are:
111 * - minify-js \see JSMin::minify
112 * - minify-css \see CSSMin::minify
113 *
114 * If $data is empty, only contains whitespace or the filter was unknown,
115 * $data is returned unmodified.
116 *
117 * @param $filter String: Name of filter to run
118 * @param $data String: Text to filter, such as JavaScript or CSS text
119 * @return String: Filtered data, or a comment containing an error message
120 */
121 protected function filter( $filter, $data ) {
122 wfProfileIn( __METHOD__ );
123
124 // For empty/whitespace-only data or for unknown filters, don't perform
125 // any caching or processing
126 if ( trim( $data ) === ''
127 || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) )
128 {
129 wfProfileOut( __METHOD__ );
130 return $data;
131 }
132
133 // Try for cache hit
134 // Use CACHE_ANYTHING since filtering is very slow compared to DB queries
135 $key = wfMemcKey( 'resourceloader', 'filter', $filter, md5( $data ) );
136 $cache = wfGetCache( CACHE_ANYTHING );
137 $cacheEntry = $cache->get( $key );
138 if ( is_string( $cacheEntry ) ) {
139 wfProfileOut( __METHOD__ );
140 return $cacheEntry;
141 }
142
143 // Run the filter - we've already verified one of these will work
144 try {
145 switch ( $filter ) {
146 case 'minify-js':
147 $result = JSMin::minify( $data );
148 break;
149 case 'minify-css':
150 $result = CSSMin::minify( $data );
151 break;
152 }
153
154 // Save filtered text to Memcached
155 $cache->set( $key, $result );
156 } catch ( Exception $exception ) {
157 // Return exception as a comment
158 $result = "/*\n{$exception->__toString()}\n*/\n";
159 }
160
161 wfProfileOut( __METHOD__ );
162
163 return $result;
164 }
165
166 /* Methods */
167
168 /**
169 * Registers core modules and runs registration hooks.
170 */
171 public function __construct() {
172 global $IP, $wgResourceModules;
173
174 wfProfileIn( __METHOD__ );
175
176 // Register core modules
177 $this->register( include( "$IP/resources/Resources.php" ) );
178 // Register extension modules
179 wfRunHooks( 'ResourceLoaderRegisterModules', array( &$this ) );
180 $this->register( $wgResourceModules );
181
182 wfProfileOut( __METHOD__ );
183 }
184
185 /**
186 * Registers a module with the ResourceLoader system.
187 *
188 * @param $name Mixed: Name of module as a string or List of name/object pairs as an array
189 * @param $info Module info array. For backwards compatibility with 1.17alpha,
190 * this may also be a ResourceLoaderModule object. Optional when using
191 * multiple-registration calling style.
192 * @throws MWException: If a duplicate module registration is attempted
193 * @throws MWException: If something other than a ResourceLoaderModule is being registered
194 * @return Boolean: False if there were any errors, in which case one or more modules were not
195 * registered
196 */
197 public function register( $name, $info = null ) {
198 wfProfileIn( __METHOD__ );
199
200 // Allow multiple modules to be registered in one call
201 if ( is_array( $name ) ) {
202 foreach ( $name as $key => $value ) {
203 $this->register( $key, $value );
204 }
205 return;
206 }
207
208 // Disallow duplicate registrations
209 if ( isset( $this->moduleInfos[$name] ) ) {
210 // A module has already been registered by this name
211 throw new MWException(
212 'ResourceLoader duplicate registration error. ' .
213 'Another module has already been registered as ' . $name
214 );
215 }
216
217 // Attach module
218 if ( is_object( $info ) ) {
219 // Old calling convention
220 // Validate the input
221 if ( !( $info instanceof ResourceLoaderModule ) ) {
222 throw new MWException( 'ResourceLoader invalid module error. ' .
223 'Instances of ResourceLoaderModule expected.' );
224 }
225
226 $this->moduleInfos[$name] = array( 'object' => $info );
227 $info->setName( $name );
228 $this->modules[$name] = $info;
229 } else {
230 // New calling convention
231 $this->moduleInfos[$name] = $info;
232 }
233
234 wfProfileOut( __METHOD__ );
235 }
236
237 /**
238 * Get a list of module names
239 *
240 * @return Array: List of module names
241 */
242 public function getModuleNames() {
243 return array_keys( $this->moduleInfos );
244 }
245
246 /**
247 * Get the ResourceLoaderModule object for a given module name.
248 *
249 * @param $name String: Module name
250 * @return Mixed: ResourceLoaderModule if module has been registered, null otherwise
251 */
252 public function getModule( $name ) {
253 if ( !isset( $this->modules[$name] ) ) {
254 if ( !isset( $this->moduleInfos[$name] ) ) {
255 // No such module
256 return null;
257 }
258 // Construct the requested object
259 $info = $this->moduleInfos[$name];
260 if ( isset( $info['object'] ) ) {
261 // Object given in info array
262 $object = $info['object'];
263 } else {
264 if ( !isset( $info['class'] ) ) {
265 $class = 'ResourceLoaderFileModule';
266 } else {
267 $class = $info['class'];
268 }
269 $object = new $class( $info );
270 }
271 $object->setName( $name );
272 $this->modules[$name] = $object;
273 }
274
275 return $this->modules[$name];
276 }
277
278 /**
279 * Outputs a response to a resource load-request, including a content-type header.
280 *
281 * @param $context ResourceLoaderContext: Context in which a response should be formed
282 */
283 public function respond( ResourceLoaderContext $context ) {
284 global $wgResourceLoaderMaxage, $wgCacheEpoch;
285
286 // Buffer output to catch warnings. Normally we'd use ob_clean() on the
287 // top-level output buffer to clear warnings, but that breaks when ob_gzhandler
288 // is used: ob_clean() will clear the GZIP header in that case and it won't come
289 // back for subsequent output, resulting in invalid GZIP. So we have to wrap
290 // the whole thing in our own output buffer to be sure the active buffer
291 // doesn't use ob_gzhandler.
292 // See http://bugs.php.net/bug.php?id=36514
293 ob_start();
294
295 wfProfileIn( __METHOD__ );
296 $exceptions = '';
297
298 // Split requested modules into two groups, modules and missing
299 $modules = array();
300 $missing = array();
301 foreach ( $context->getModules() as $name ) {
302 if ( isset( $this->moduleInfos[$name] ) ) {
303 $modules[$name] = $this->getModule( $name );
304 } else {
305 $missing[] = $name;
306 }
307 }
308
309 // If a version wasn't specified we need a shorter expiry time for updates
310 // to propagate to clients quickly
311 if ( is_null( $context->getVersion() ) ) {
312 $maxage = $wgResourceLoaderMaxage['unversioned']['client'];
313 $smaxage = $wgResourceLoaderMaxage['unversioned']['server'];
314 }
315 // If a version was specified we can use a longer expiry time since changing
316 // version numbers causes cache misses
317 else {
318 $maxage = $wgResourceLoaderMaxage['versioned']['client'];
319 $smaxage = $wgResourceLoaderMaxage['versioned']['server'];
320 }
321
322 // Preload information needed to the mtime calculation below
323 try {
324 $this->preloadModuleInfo( array_keys( $modules ), $context );
325 } catch( Exception $e ) {
326 // Add exception to the output as a comment
327 $exceptions .= "/*\n{$e->__toString()}\n*/\n";
328 }
329
330 wfProfileIn( __METHOD__.'-getModifiedTime' );
331
332 // To send Last-Modified and support If-Modified-Since, we need to detect
333 // the last modified time
334 $mtime = wfTimestamp( TS_UNIX, $wgCacheEpoch );
335 foreach ( $modules as $module ) {
336 try {
337 // Bypass squid cache if the request includes any private modules
338 if ( $module->getGroup() === 'private' ) {
339 $smaxage = 0;
340 }
341 // Calculate maximum modified time
342 $mtime = max( $mtime, $module->getModifiedTime( $context ) );
343 } catch ( Exception $e ) {
344 // Add exception to the output as a comment
345 $exceptions .= "/*\n{$e->__toString()}\n*/\n";
346 }
347 }
348
349 wfProfileOut( __METHOD__.'-getModifiedTime' );
350
351 if ( $context->getOnly() === 'styles' ) {
352 header( 'Content-Type: text/css' );
353 } else {
354 header( 'Content-Type: text/javascript' );
355 }
356 header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $mtime ) );
357 if ( $context->getDebug() ) {
358 header( 'Cache-Control: must-revalidate' );
359 } else {
360 header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage" );
361 header( 'Expires: ' . wfTimestamp( TS_RFC2822, min( $maxage, $smaxage ) + time() ) );
362 }
363
364 // If there's an If-Modified-Since header, respond with a 304 appropriately
365 // Some clients send "timestamp;length=123". Strip the part after the first ';'
366 // so we get a valid timestamp.
367 $ims = $context->getRequest()->getHeader( 'If-Modified-Since' );
368 if ( $ims !== false ) {
369 $imsTS = strtok( $ims, ';' );
370 if ( $mtime <= wfTimestamp( TS_UNIX, $imsTS ) ) {
371 // There's another bug in ob_gzhandler (see also the comment at
372 // the top of this function) that causes it to gzip even empty
373 // responses, meaning it's impossible to produce a truly empty
374 // response (because the gzip header is always there). This is
375 // a problem because 304 responses have to be completely empty
376 // per the HTTP spec, and Firefox behaves buggily when they're not.
377 // See also http://bugs.php.net/bug.php?id=51579
378 // To work around this, we tear down all output buffering before
379 // sending the 304.
380 // On some setups, ob_get_level() doesn't seem to go down to zero
381 // no matter how often we call ob_get_clean(), so instead of doing
382 // the more intuitive while ( ob_get_level() > 0 ) ob_get_clean();
383 // we have to be safe here and avoid an infinite loop.
384 for ( $i = 0; $i < ob_get_level(); $i++ ) {
385 ob_end_clean();
386 }
387
388 header( 'HTTP/1.0 304 Not Modified' );
389 header( 'Status: 304 Not Modified' );
390 wfProfileOut( __METHOD__ );
391 return;
392 }
393 }
394
395 // Generate a response
396 $response = $this->makeModuleResponse( $context, $modules, $missing );
397
398 // Prepend comments indicating exceptions
399 $response = $exceptions . $response;
400
401 // Capture any PHP warnings from the output buffer and append them to the
402 // response in a comment if we're in debug mode.
403 if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) {
404 $response = "/*\n$warnings\n*/\n" . $response;
405 }
406
407 // Remove the output buffer and output the response
408 ob_end_clean();
409 echo $response;
410
411 wfProfileOut( __METHOD__ );
412 }
413
414 /**
415 * Generates code for a response
416 *
417 * @param $context ResourceLoaderContext: Context in which to generate a response
418 * @param $modules Array: List of module objects keyed by module name
419 * @param $missing Array: List of unavailable modules (optional)
420 * @return String: Response data
421 */
422 public function makeModuleResponse( ResourceLoaderContext $context,
423 array $modules, $missing = array() )
424 {
425 $out = '';
426 $exceptions = '';
427 if ( $modules === array() && $missing === array() ) {
428 return '/* No modules requested. Max made me put this here */';
429 }
430
431 // Pre-fetch blobs
432 if ( $context->shouldIncludeMessages() ) {
433 try {
434 $blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() );
435 } catch ( Exception $e ) {
436 // Add exception to the output as a comment
437 $exceptions .= "/*\n{$e->__toString()}\n*/\n";
438 }
439 } else {
440 $blobs = array();
441 }
442
443 // Generate output
444 foreach ( $modules as $name => $module ) {
445 wfProfileIn( __METHOD__ . '-' . $name );
446 try {
447 // Scripts
448 $scripts = '';
449 if ( $context->shouldIncludeScripts() ) {
450 $scripts .= $module->getScript( $context ) . "\n";
451 }
452
453 // Styles
454 $styles = array();
455 if ( $context->shouldIncludeStyles() ) {
456 $styles = $module->getStyles( $context );
457 }
458
459 // Messages
460 $messagesBlob = isset( $blobs[$name] ) ? $blobs[$name] : '{}';
461
462 // Append output
463 switch ( $context->getOnly() ) {
464 case 'scripts':
465 $out .= $scripts;
466 break;
467 case 'styles':
468 $out .= self::makeCombinedStyles( $styles );
469 break;
470 case 'messages':
471 $out .= self::makeMessageSetScript( new XmlJsCode( $messagesBlob ) );
472 break;
473 default:
474 // Minify CSS before embedding in mediaWiki.loader.implement call
475 // (unless in debug mode)
476 if ( !$context->getDebug() ) {
477 foreach ( $styles as $media => $style ) {
478 $styles[$media] = $this->filter( 'minify-css', $style );
479 }
480 }
481 $out .= self::makeLoaderImplementScript( $name, $scripts, $styles,
482 new XmlJsCode( $messagesBlob ) );
483 break;
484 }
485 } catch ( Exception $e ) {
486 // Add exception to the output as a comment
487 $exceptions .= "/*\n{$e->__toString()}\n*/\n";
488
489 // Register module as missing
490 $missing[] = $name;
491 unset( $modules[$name] );
492 }
493 wfProfileOut( __METHOD__ . '-' . $name );
494 }
495
496 // Update module states
497 if ( $context->shouldIncludeScripts() ) {
498 // Set the state of modules loaded as only scripts to ready
499 if ( count( $modules ) && $context->getOnly() === 'scripts'
500 && !isset( $modules['startup'] ) )
501 {
502 $out .= self::makeLoaderStateScript(
503 array_fill_keys( array_keys( $modules ), 'ready' ) );
504 }
505 // Set the state of modules which were requested but unavailable as missing
506 if ( is_array( $missing ) && count( $missing ) ) {
507 $out .= self::makeLoaderStateScript( array_fill_keys( $missing, 'missing' ) );
508 }
509 }
510
511 if ( $context->getDebug() ) {
512 return $exceptions . $out;
513 } else {
514 if ( $context->getOnly() === 'styles' ) {
515 return $exceptions . $this->filter( 'minify-css', $out );
516 } else {
517 return $exceptions . $this->filter( 'minify-js', $out );
518 }
519 }
520 }
521
522 /* Static Methods */
523
524 /**
525 * Returns JS code to call to mediaWiki.loader.implement for a module with
526 * given properties.
527 *
528 * @param $name Module name
529 * @param $scripts Array: List of JavaScript code snippets to be executed after the
530 * module is loaded
531 * @param $styles Array: List of CSS strings keyed by media type
532 * @param $messages Mixed: List of messages associated with this module. May either be an
533 * associative array mapping message key to value, or a JSON-encoded message blob containing
534 * the same data, wrapped in an XmlJsCode object.
535 */
536 public static function makeLoaderImplementScript( $name, $scripts, $styles, $messages ) {
537 if ( is_array( $scripts ) ) {
538 $scripts = implode( $scripts, "\n" );
539 }
540 return Xml::encodeJsCall(
541 'mediaWiki.loader.implement',
542 array(
543 $name,
544 new XmlJsCode( "function( $, mw ) {{$scripts}}" ),
545 (object)$styles,
546 (object)$messages
547 ) );
548 }
549
550 /**
551 * Returns JS code which, when called, will register a given list of messages.
552 *
553 * @param $messages Mixed: Either an associative array mapping message key to value, or a
554 * JSON-encoded message blob containing the same data, wrapped in an XmlJsCode object.
555 */
556 public static function makeMessageSetScript( $messages ) {
557 return Xml::encodeJsCall( 'mediaWiki.messages.set', array( (object)$messages ) );
558 }
559
560 /**
561 * Combines an associative array mapping media type to CSS into a
562 * single stylesheet with @media blocks.
563 *
564 * @param $styles Array: List of CSS strings keyed by media type
565 */
566 public static function makeCombinedStyles( array $styles ) {
567 $out = '';
568 foreach ( $styles as $media => $style ) {
569 // Transform the media type based on request params and config
570 // The way that this relies on $wgRequest to propagate request params is slightly evil
571 $media = OutputPage::transformCssMedia( $media );
572
573 if ( $media === null ) {
574 // Skip
575 } else if ( $media === '' || $media == 'all' ) {
576 // Don't output invalid or frivolous @media statements
577 $out .= "$style\n";
578 } else {
579 $out .= "@media $media {\n" . str_replace( "\n", "\n\t", "\t" . $style ) . "\n}\n";
580 }
581 }
582 return $out;
583 }
584
585 /**
586 * Returns a JS call to mediaWiki.loader.state, which sets the state of a
587 * module or modules to a given value. Has two calling conventions:
588 *
589 * - ResourceLoader::makeLoaderStateScript( $name, $state ):
590 * Set the state of a single module called $name to $state
591 *
592 * - ResourceLoader::makeLoaderStateScript( array( $name => $state, ... ) ):
593 * Set the state of modules with the given names to the given states
594 */
595 public static function makeLoaderStateScript( $name, $state = null ) {
596 if ( is_array( $name ) ) {
597 return Xml::encodeJsCall( 'mediaWiki.loader.state', array( $name ) );
598 } else {
599 return Xml::encodeJsCall( 'mediaWiki.loader.state', array( $name, $state ) );
600 }
601 }
602
603 /**
604 * Returns JS code which calls the script given by $script. The script will
605 * be called with local variables name, version, dependencies and group,
606 * which will have values corresponding to $name, $version, $dependencies
607 * and $group as supplied.
608 *
609 * @param $name String: Module name
610 * @param $version Integer: Module version number as a timestamp
611 * @param $dependencies Array: List of module names on which this module depends
612 * @param $group String: Group which the module is in.
613 * @param $script String: JavaScript code
614 */
615 public static function makeCustomLoaderScript( $name, $version, $dependencies, $group, $script ) {
616 $script = str_replace( "\n", "\n\t", trim( $script ) );
617 return Xml::encodeJsCall(
618 "( function( name, version, dependencies, group ) {\n\t$script\n} )",
619 array( $name, $version, $dependencies, $group ) );
620 }
621
622 /**
623 * Returns JS code which calls mediaWiki.loader.register with the given
624 * parameters. Has three calling conventions:
625 *
626 * - ResourceLoader::makeLoaderRegisterScript( $name, $version, $dependencies, $group ):
627 * Register a single module.
628 *
629 * - ResourceLoader::makeLoaderRegisterScript( array( $name1, $name2 ) ):
630 * Register modules with the given names.
631 *
632 * - ResourceLoader::makeLoaderRegisterScript( array(
633 * array( $name1, $version1, $dependencies1, $group1 ),
634 * array( $name2, $version2, $dependencies1, $group2 ),
635 * ...
636 * ) ):
637 * Registers modules with the given names and parameters.
638 *
639 * @param $name String: Module name
640 * @param $version Integer: Module version number as a timestamp
641 * @param $dependencies Array: List of module names on which this module depends
642 * @param $group String: group which the module is in.
643 */
644 public static function makeLoaderRegisterScript( $name, $version = null,
645 $dependencies = null, $group = null )
646 {
647 if ( is_array( $name ) ) {
648 return Xml::encodeJsCall( 'mediaWiki.loader.register', array( $name ) );
649 } else {
650 $version = (int) $version > 1 ? (int) $version : 1;
651 return Xml::encodeJsCall( 'mediaWiki.loader.register',
652 array( $name, $version, $dependencies, $group ) );
653 }
654 }
655
656 /**
657 * Returns JS code which runs given JS code if the client-side framework is
658 * present.
659 *
660 * @param $script String: JavaScript code
661 */
662 public static function makeLoaderConditionalScript( $script ) {
663 $script = str_replace( "\n", "\n\t", trim( $script ) );
664 return "if ( window.mediaWiki ) {\n\t$script\n}\n";
665 }
666
667 /**
668 * Returns JS code which will set the MediaWiki configuration array to
669 * the given value.
670 *
671 * @param $configuration Array: List of configuration values keyed by variable name
672 */
673 public static function makeConfigSetScript( array $configuration ) {
674 return Xml::encodeJsCall( 'mediaWiki.config.set', array( $configuration ) );
675 }
676
677 /**
678 * Determine whether debug mode was requested
679 * Order of priority is 1) request param, 2) cookie, 3) $wg setting
680 * @return bool
681 */
682 public static function inDebugMode() {
683 global $wgRequest, $wgResourceLoaderDebug;
684 static $retval = null;
685 if ( !is_null( $retval ) )
686 return $retval;
687 return $retval = $wgRequest->getFuzzyBool( 'debug',
688 $wgRequest->getCookie( 'resourceLoaderDebug', '', $wgResourceLoaderDebug ) );
689 }
690 }