Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403835 )

Change subject: JavaScriptMinifier: Remove support for unused $maxLineLength 
param
......................................................................

JavaScriptMinifier: Remove support for unused $maxLineLength param

Follows-up 93b8023946b0e.

The $wgResourceLoaderMinifierMaxLineLength config var was deprecated
in MediaWiki 1.27. The parameter of minify() was not used by other
code, and no new usage has been introduced since then, either.

Remove the feature from JavaScriptMinifier, and add a release note.
The 1.31 release notes already contain a note about the removal
of the configuration variables.

The feature was not covered by unit tests.

Change-Id: I38eb4187e3a8e2d882f317481b43f0bf6ac3bada
---
M RELEASE-NOTES-1.31
M includes/libs/JavaScriptMinifier.php
2 files changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/35/403835/1

diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31
index 30a174a..e17338d 100644
--- a/RELEASE-NOTES-1.31
+++ b/RELEASE-NOTES-1.31
@@ -163,6 +163,9 @@
 * The $statementsOnOwnLine parameter of JavaScriptMinifier::minify was removed.
   The corresponding configuration variable 
($wgResourceLoaderMinifierStatementsOnOwnLine)
   has been deprecated since 1.27 and was removed as well.
+* The $maxLineLength parameter of JavaScriptMinifier::minify was removed.
+  The corresponding configuration variable 
($wgResourceLoaderMinifierMaxLineLength)
+  has been deprecated since 1.27 and was removed as well.
 * The HtmlFormatter class was removed (deprecated in 1.27). The namespaced
   HtmlFormatter\HtmlFormatter class should be used instead.
 
diff --git a/includes/libs/JavaScriptMinifier.php 
b/includes/libs/JavaScriptMinifier.php
index 3f46453..a1a93d2 100644
--- a/includes/libs/JavaScriptMinifier.php
+++ b/includes/libs/JavaScriptMinifier.php
@@ -63,17 +63,19 @@
        const STACK_LIMIT = 1000;
 
        /**
+        * NOTE: This isn't a strict maximum. Longer lines will be produced when
+        *       literals (e.g. quoted strings) longer than this are encountered
+        *       or when required to guard against semicolon insertion.
+        */
+       const MAX_LINE_LENGTH = 1000;
+
+       /**
         * Returns minified JavaScript code.
         *
-        * NOTE: $maxLineLength isn't a strict maximum. Longer lines will be 
produced when
-        *       literals (e.g. quoted strings) longer than $maxLineLength are 
encountered
-        *       or when required to guard against semicolon insertion.
-        *
         * @param string $s JavaScript code to minify
-        * @param int $maxLineLength Maximum length of a single line, or -1 for 
no maximum.
         * @return String Minified code
         */
-       public static function minify( $s, $maxLineLength = 1000 ) {
+       public static function minify( $s ) {
                // First we declare a few tables that contain our parsing rules
 
                // $opChars : characters, which can be combined without 
whitespace in between them
@@ -571,7 +573,7 @@
                                $out .= "\n";
                                $state = self::STATEMENT;
                                $lineLength = 0;
-                       } elseif ( $maxLineLength > 0 && $lineLength + $end - 
$pos > $maxLineLength &&
+                       } elseif ( $lineLength + $end - $pos > 
self::MAX_LINE_LENGTH &&
                                        !isset( $semicolon[$state][$type] ) && 
$type !== self::TYPE_INCR_OP ) {
                                // This line would get too long if we added 
$token, so add a newline first.
                                // Only do this if it won't trigger semicolon 
insertion and if it won't

-- 
To view, visit https://gerrit.wikimedia.org/r/403835
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38eb4187e3a8e2d882f317481b43f0bf6ac3bada
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to