Bug 1623703 - Port bug 1623222: Remove the charset parameter from nsITextToSubURI::UnEscapeURIForUI. r=mkmelin
authorRichard Marti <richard.marti@gmail.com>
Thu, 19 Mar 2020 21:39:39 +0200
changeset 38536 8580290d78331f918b6385943e868cd45968acbc
parent 38535 fa2ff756eb23b0035587cfb49d416222c031bcf4
child 38537 a37cba884251c58d9304e65870ab18cb95df9ddb
push id400
push userclokep@gmail.com
push dateMon, 04 May 2020 18:56:09 +0000
reviewersmkmelin
bugs1623703, 1623222
Bug 1623703 - Port bug 1623222: Remove the charset parameter from nsITextToSubURI::UnEscapeURIForUI. r=mkmelin
chat/modules/imSmileys.jsm
mail/base/content/mailContextMenus.js
mail/base/content/mailWindow.js
mail/base/content/nsContextMenu.js
mailnews/compose/src/nsMsgCompose.cpp
--- a/chat/modules/imSmileys.jsm
+++ b/chat/modules/imSmileys.jsm
@@ -49,17 +49,17 @@ var gPrefObserver = {
       throw new Error("bad notification");
     }
 
     gTheme = getTheme();
   },
 };
 
 function getSmileRealURI(aSmile) {
-  aSmile = Services.textToSubURI.unEscapeURIForUI("UTF-8", aSmile);
+  aSmile = Services.textToSubURI.unEscapeURIForUI(aSmile);
   if (aSmile in gTheme.iconsHash) {
     return gTheme.baseUri + gTheme.iconsHash[aSmile].filename;
   }
 
   throw new Error("Invalid smile!");
 }
 
 function getSmileyList(aThemeName) {
--- a/mail/base/content/mailContextMenus.js
+++ b/mail/base/content/mailContextMenus.js
@@ -750,18 +750,17 @@ function getEmail(url) {
 
   if (qmark > mailtolength) {
     addresses = url.substring(mailtolength, qmark);
   } else {
     addresses = url.substr(mailtolength);
   }
   // Let's try to unescape it using a character set
   try {
-    var characterSet = gContextMenu.target.ownerDocument.characterSet;
-    addresses = Services.textToSubURI.unEscapeURIForUI(characterSet, addresses);
+    addresses = Services.textToSubURI.unEscapeURIForUI(addresses);
   } catch (ex) {
     // Do nothing.
   }
   return addresses;
 }
 
 function CopyMessageUrl() {
   try {
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -304,17 +304,17 @@ nsMsgStatusFeedback.prototype = {
   /*
    * Set the statusbar display for hovered links, from browser.js.
    *
    * @param {String} url        - The href to display.
    * @param {Element} anchorElt - Element.
    */
   setOverLink(url, anchorElt) {
     if (url) {
-      url = Services.textToSubURI.unEscapeURIForUI("UTF-8", url);
+      url = Services.textToSubURI.unEscapeURIForUI(url);
 
       // Encode bidirectional formatting characters.
       // (RFC 3987 sections 3.2 and 4.1 paragraph 6)
       url = url.replace(
         /[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
         encodeURIComponent
       );
     }
--- a/mail/base/content/nsContextMenu.js
+++ b/mail/base/content/nsContextMenu.js
@@ -862,21 +862,17 @@ nsContextMenu.prototype = {
     if (qmark > kMailToLength) {
       addresses = url.substring(kMailToLength, qmark);
     } else {
       addresses = url.substr(kMailToLength);
     }
 
     // Let's try to unescape it using a character set.
     try {
-      var characterSet = this.target.ownerDocument.characterSet;
-      addresses = Services.textToSubURI.unEscapeURIForUI(
-        characterSet,
-        addresses
-      );
+      addresses = Services.textToSubURI.unEscapeURIForUI(addresses);
     } catch (ex) {
       // Do nothing.
     }
 
     var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
       Ci.nsIClipboardHelper
     );
     clipboard.copyString(addresses);
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -4393,25 +4393,22 @@ nsresult nsMsgCompose::AttachmentPrettyN
     NS_ENSURE_SUCCESS(rv, rv);
     nsAutoString leafName;
     rv = file->GetLeafName(leafName);
     NS_ENSURE_SUCCESS(rv, rv);
     CopyUTF16toUTF8(leafName, _retval);
     return rv;
   }
 
-  // To work around a mysterious bug in VC++ 6.
-  const char *cset = (!charset || !*charset) ? "UTF-8" : charset;
-
   nsCOMPtr<nsITextToSubURI> textToSubURI =
       do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString retUrl;
-  rv = textToSubURI->UnEscapeURIForUI(nsDependentCString(cset), scheme, retUrl);
+  rv = textToSubURI->UnEscapeURIForUI(scheme, retUrl);
 
   if (NS_SUCCEEDED(rv)) {
     CopyUTF16toUTF8(retUrl, _retval);
   } else {
     _retval.Assign(scheme);
   }
   if (StringHead(scheme, 5).LowerCaseEqualsLiteral("http:")) _retval.Cut(0, 7);