Merge "jquery.suggestions: Combine two isRTL checks"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoader.php
index 8d60e0f..515f287 100644 (file)
@@ -236,15 +236,14 @@ class ResourceLoader implements LoggerAwareInterface {
 
        /**
         * Register core modules and runs registration hooks.
-        * @param Config|null $config [optional]
+        * @param Config|null $config
         * @param LoggerInterface|null $logger [optional]
         */
        public function __construct( Config $config = null, LoggerInterface $logger = null ) {
                $this->logger = $logger ?: new NullLogger();
 
                if ( !$config ) {
-                       // TODO: Deprecate and remove.
-                       $this->logger->debug( __METHOD__ . ' was called without providing a Config instance' );
+                       wfDeprecated( __METHOD__ . ' without a Config instance', '1.34' );
                        $config = MediaWikiServices::getInstance()->getMainConfig();
                }
                $this->config = $config;
@@ -255,17 +254,6 @@ class ResourceLoader implements LoggerAwareInterface {
                // Special module that always exists
                $this->register( 'startup', [ 'class' => ResourceLoaderStartUpModule::class ] );
 
-               // Register extension modules
-               $this->register( $config->get( 'ResourceModules' ) );
-
-               // Avoid PHP 7.1 warning from passing $this by reference
-               $rl = $this;
-               Hooks::run( 'ResourceLoaderRegisterModules', [ &$rl ] );
-
-               if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
-                       $this->registerTestModules();
-               }
-
                $this->setMessageBlobStore( new MessageBlobStore( $this, $this->logger ) );
        }
 
@@ -394,6 +382,9 @@ class ResourceLoader implements LoggerAwareInterface {
                }
        }
 
+       /**
+        * @internal For use by ServiceWiring only
+        */
        public function registerTestModules() {
                global $IP;
 
@@ -1490,7 +1481,7 @@ MESSAGE;
         */
        public static function makeLoaderConditionalScript( $script ) {
                // Adds a function to lazy-created RLQ
-               return '(window.RLQ=window.RLQ||[]).push(function(){' .
+               return '(RLQ=window.RLQ||[]).push(function(){' .
                        trim( $script ) . '});';
        }
 
@@ -1504,7 +1495,7 @@ MESSAGE;
         */
        public static function makeInlineCodeWithModule( $modules, $script ) {
                // Adds an array to lazy-created RLQ
-               return '(window.RLQ=window.RLQ||[]).push(['
+               return '(RLQ=window.RLQ||[]).push(['
                        . self::encodeJsonForScript( $modules ) . ','
                        . 'function(){' . trim( $script ) . '}'
                        . ']);';
@@ -1535,7 +1526,7 @@ MESSAGE;
 
                return new WrappedString(
                        Html::inlineScript( $js, $nonce ),
-                       "<script$escNonce>(window.RLQ=window.RLQ||[]).push(function(){",
+                       "<script$escNonce>(RLQ=window.RLQ||[]).push(function(){",
                        '});</script>'
                );
        }