Bug 1391421 - Part 6 - Switch context menus to Unicode domains. r?jwu draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 16 Sep 2017 15:01:09 +0200
changeset 666450 dfa4aec27a6c51e106425a485702cee63c1802fa
parent 666449 4b447648f7735f22c0fb464f463dfe3b8d85830a
child 666451 34778d340777831ced52cd60a592251ab7eea14d
push id80411
push usermozilla@buttercookie.de
push dateMon, 18 Sep 2017 19:20:36 +0000
reviewersjwu
bugs1391421
milestone57.0a1
Bug 1391421 - Part 6 - Switch context menus to Unicode domains. r?jwu MozReview-Commit-ID: 6yjtRGI6Aui
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2824,17 +2824,17 @@ var NativeWindow = {
           (node instanceof Ci.nsIDOMHTMLAreaElement && node.href)) {
         return this._getLinkURL(node);
       } else if (node instanceof Ci.nsIImageLoadingContent && node.currentURI) {
         // The image is blocked by Tap-to-load Images
         let originalURL = node.getAttribute("data-ctv-src");
         if (originalURL) {
           return originalURL;
         }
-        return node.currentURI.spec;
+        return node.currentURI.displaySpec;
       } else if (node instanceof Ci.nsIDOMHTMLMediaElement) {
         let srcUrl = node.currentSrc || node.src;
         // If URL prepended with blob or mediasource, we'll remove it.
         return srcUrl.replace(/^(?:blob|mediasource):/, '');
       }
 
       return "";
     },
@@ -3037,17 +3037,17 @@ var NativeWindow = {
         }
         target = target.parentNode;
       }
     },
 
     // XXX - These are stolen from Util.js, we should remove them if we bring it back
     makeURLAbsolute: function makeURLAbsolute(base, url) {
       // Note:  makeURI() will throw if url is not a valid URI
-      return this.makeURI(url, null, this.makeURI(base)).spec;
+      return this.makeURI(url, null, this.makeURI(base)).displaySpec;
     },
 
     makeURI: function makeURI(aURL, aOriginCharset, aBaseURI) {
       return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
     },
 
     _getLink: function(aElement) {
       if (aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
@@ -3072,18 +3072,19 @@ var NativeWindow = {
 
           return selector.matches(aElement, aX, aY);
         }
       };
     },
 
     _getLinkURL: function ch_getLinkURL(aLink) {
       let href = aLink.href;
-      if (href)
-        return href;
+      if (href) {
+        return this.makeURI(href).displaySpec;
+      }
 
       href = aLink.getAttribute("href") ||
              aLink.getAttributeNS(kXLinkNamespace, "href");
       if (!href || !href.match(/\S/)) {
         // Without this we try to save as the current doc,
         // for example, HTML case also throws if empty
         throw "Empty href";
       }