jenkins-bot has submitted this change and it was merged.

Change subject: Removed Xml::escapeJsString()
......................................................................


Removed Xml::escapeJsString()

Change-Id: Iead8385a72a79632a90594a8828080a6d572e039
---
M RELEASE-NOTES-1.29
M includes/Xml.php
M tests/phpunit/includes/XmlTest.php
3 files changed, 1 insertion(+), 47 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29
index ef353ed..98d2a17 100644
--- a/RELEASE-NOTES-1.29
+++ b/RELEASE-NOTES-1.29
@@ -59,6 +59,7 @@
 * MWHttpRequest::execute() should be considered to return a StatusValue; the
   Status return type is deprecated.
 * User::edits() (deprecated in 1.21) was removed.
+* Xml::escapeJsString() (deprecated in 1.21) was removed.
 
 == Compatibility ==
 
diff --git a/includes/Xml.php b/includes/Xml.php
index 4c6b071..e124c38 100644
--- a/includes/Xml.php
+++ b/includes/Xml.php
@@ -614,42 +614,6 @@
        }
 
        /**
-        * Returns an escaped string suitable for inclusion in a string literal
-        * for JavaScript source code.
-        * Illegal control characters are assumed not to be present.
-        *
-        * @deprecated since 1.21; use Xml::encodeJsVar() or 
Xml::encodeJsCall() instead
-        * @param string $string String to escape
-        * @return string
-        */
-       public static function escapeJsString( $string ) {
-               // See ECMA 262 section 7.8.4 for string literal format
-               $pairs = [
-                       "\\" => "\\\\",
-                       "\"" => "\\\"",
-                       '\'' => '\\\'',
-                       "\n" => "\\n",
-                       "\r" => "\\r",
-
-                       # To avoid closing the element or CDATA section
-                       "<" => "\\x3c",
-                       ">" => "\\x3e",
-
-                       # To avoid any complaints about bad entity refs
-                       "&" => "\\x26",
-
-                       # Work around 
https://bugzilla.mozilla.org/show_bug.cgi?id=274152
-                       # Encode certain Unicode formatting chars so affected
-                       # versions of Gecko don't misinterpret our strings;
-                       # this is a common problem with Farsi text.
-                       "\xe2\x80\x8c" => "\\u200c", // ZERO WIDTH NON-JOINER
-                       "\xe2\x80\x8d" => "\\u200d", // ZERO WIDTH JOINER
-               ];
-
-               return strtr( $string, $pairs );
-       }
-
-       /**
         * Encode a variable of arbitrary type to JavaScript.
         * If the value is an XmlJsCode object, pass through the object's value 
verbatim.
         *
diff --git a/tests/phpunit/includes/XmlTest.php 
b/tests/phpunit/includes/XmlTest.php
index dbd1299..18ff1f4 100644
--- a/tests/phpunit/includes/XmlTest.php
+++ b/tests/phpunit/includes/XmlTest.php
@@ -306,17 +306,6 @@
        }
 
        /**
-        * @covers Xml::escapeJsString
-        */
-       public function testEscapeJsStringSpecialChars() {
-               $this->assertEquals(
-                       '\\\\\r\n',
-                       Xml::escapeJsString( "\\\r\n" ),
-                       'escapeJsString() with special characters'
-               );
-       }
-
-       /**
         * @covers Xml::encodeJsVar
         */
        public function testEncodeJsVarBoolean() {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iead8385a72a79632a90594a8828080a6d572e039
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to