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 665967 30adf66019d155dba82ecf235a9f9fb617625015
parent 665966 8adee8be304d97d2eab8c80f05a39d356469a87d
child 665968 a8141de487e64037e1a45301cb0a483aaed3cb8f
push id80237
push usermozilla@buttercookie.de
push dateSat, 16 Sep 2017 21:17:08 +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";
       }