Bug 1938933 - Switch from deprecated escape/unescape in cZ. r=frg DONTBUILD
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sat, 22 Feb 2025 13:35:25 +0000 (4 months ago)
changeset 44170 21962fb0b384f5540ed8705db49e42cb83d0e6e5
parent 44169 d66aec9839b953a020563d1b1d199868a4adbc9e
child 44171 ee82f20f5a88967160a1884503571899cda56bc0
push id23382
push userfrgrahl@gmx.net
push dateSun, 16 Mar 2025 13:58:52 +0000 (3 months ago)
treeherdercomm-central@34b69871b918 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg
bugs1938933
Bug 1938933 - Switch from deprecated escape/unescape in cZ. r=frg DONTBUILD
suite/chatzilla/js/lib/dcc.js
suite/chatzilla/js/lib/pref-manager.js
suite/chatzilla/xul/content/commands.js
--- a/suite/chatzilla/js/lib/dcc.js
+++ b/suite/chatzilla/js/lib/dcc.js
@@ -258,17 +258,17 @@ function CIRCDCCUser(parent, user, remot
   this.parent = parent;
   this.netUser = user;
   this.id = parent.getNextID();
   this.unicodeName = user.unicodeName;
   this.viewName = user.unicodeName;
   this.canonicalName = user.collectionKey.substr(1);
   this.remoteIP = remoteIP;
 
-  this.key = escape(user.collectionKey) + ":" + remoteIP;
+  this.key = encodeURIComponent(user.collectionKey) + ":" + remoteIP;
   user.dccUser = this;
   this.parent.users[this.key] = this;
 
   if ("onInit" in this) {
     this.onInit();
   }
 
   return this;
--- a/suite/chatzilla/js/lib/pref-manager.js
+++ b/suite/chatzilla/js/lib/pref-manager.js
@@ -186,28 +186,28 @@ PrefManager.prototype.updateArrayPref = 
   this.delayedSave();
 };
 
 PrefManager.prototype.stringToArray = function pm_s2a(string) {
   if (string.search(/\S/) == -1) {
     return [];
   }
 
-  var ary = string.split(/\s*;\s*/);
-  for (var i = 0; i < ary.length; ++i) {
-    ary[i] = toUnicode(unescape(ary[i]), PREF_CHARSET);
+  let ary = new Array();
+  for (let item of string.split(/\s*;\s*/)) {
+    ary.push(toUnicode(decodeURIComponent(item), PREF_CHARSET));
   }
 
   return ary;
 };
 
 PrefManager.prototype.arrayToString = function pm_a2s(ary) {
   var escapedAry = new Array();
-  for (var i = 0; i < ary.length; ++i) {
-    escapedAry[i] = escape(fromUnicode(ary[i], PREF_CHARSET));
+  for (let item of ary) {
+    escapedAry.push(encodeURIComponent(fromUnicode(item, PREF_CHARSET)));
   }
 
   return escapedAry.join("; ");
 };
 
 PrefManager.prototype.getPref = function pm_getpref(prefName, reload) {
   var prefManager = this;
 
--- a/suite/chatzilla/xul/content/commands.js
+++ b/suite/chatzilla/xul/content/commands.js
@@ -1350,18 +1350,18 @@ function cmdTestDisplay(e) {
 
     test(sampleUser, me); /* from user to me */
     test(me, sampleUser); /* me to user */
 
     display(MSG_TEST_URL, "PRIVMSG", sampleUser, me);
     display(MSG_TEST_STYLES, "PRIVMSG", sampleUser, me);
     display(MSG_TEST_EMOTICON, "PRIVMSG", sampleUser, me);
     display(MSG_TEST_RHEET, "PRIVMSG", sampleUser, me);
-    display(unescape(MSG_TEST_CTLCHR), "PRIVMSG", sampleUser, me);
-    display(unescape(MSG_TEST_COLOR), "PRIVMSG", sampleUser, me);
+    display(decodeURIComponent(MSG_TEST_CTLCHR), "PRIVMSG", sampleUser, me);
+    display(decodeURIComponent(MSG_TEST_COLOR), "PRIVMSG", sampleUser, me);
     display(MSG_TEST_QUOTE, "PRIVMSG", sampleUser, me);
 
     if (e.channel) {
       test(sampleUser, sampleChannel); /* user to channel */
       test(me, sampleChannel); /* me to channel */
       display(MSG_TEST_TOPIC, "TOPIC", sampleUser, sampleChannel);
       display(MSG_TEST_JOIN, "JOIN", sampleUser, sampleChannel);
       display(MSG_TEST_PART, "PART", sampleUser, sampleChannel);