resourceloader: Un-deprecate makeLoaderConditionalScript()
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 2 Mar 2018 01:12:03 +0000 (17:12 -0800)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 2 Mar 2018 01:12:03 +0000 (17:12 -0800)
It was deprecated to encourage callers to use makeInlineScript()
instead, because before makeInlineScript() was introduced, callers
would often manually wrap it in a <script> tag, which we don't want
because 1) We want de-duplication through WrappedString and 2)
callers sometimes forget to use Html.php methods that ensure
proper escaping as-needed.

However, there is still use in getting thet wrapped script without
also the wrapped HTML script tag. Namely, for use in http responses
that produce JavaScript, rather than HTML, where there cannot be
an HTML script tag.

There is at least one such caller (in SpecialJavaScriptTest) and
it's fine for there to be others.

Change-Id: Icfc285e12293c76dc68a220deb6816e32b058209

includes/resourceloader/ResourceLoader.php

index 830dbb4..f9b03c7 100644 (file)
@@ -1486,10 +1486,8 @@ MESSAGE;
        }
 
        /**
-        * Returns JS code which runs given JS code if the client-side framework is
-        * present.
+        * Wraps JavaScript code to run after startup and base modules.
         *
-        * @deprecated since 1.25; use makeInlineScript instead
         * @param string $script JavaScript code
         * @return string JavaScript code
         */
@@ -1499,10 +1497,10 @@ MESSAGE;
        }
 
        /**
-        * Construct an inline script tag with given JS code.
+        * Returns an HTML script tag that runs given JS code after startup and base modules.
         *
-        * The code will be wrapped in a closure, and it will be executed by ResourceLoader
-        * only if the client has adequate support for MediaWiki JavaScript code.
+        * The code will be wrapped in a closure, and it will be executed by ResourceLoader's
+        * startup module if the client has adequate support for MediaWiki JavaScript code.
         *
         * @param string $script JavaScript code
         * @return WrappedString HTML