Bug 1380617 - Make the PageInfo panel return unicode URLs r=Gijs
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 09 Aug 2017 17:43:56 +0200
changeset 643340 87bfb9b2974c83c7c7f71cb0587236292c12a47d
parent 643339 a6cca2e3574180562901d6c5b529ff3db1c0da8d
child 643341 82c04a5c89b6bbe4a711a7e6531bc50ec5e48483
push id73068
push usergpascutto@mozilla.com
push dateWed, 09 Aug 2017 16:52:24 +0000
reviewersGijs
bugs1380617
milestone57.0a1
Bug 1380617 - Make the PageInfo panel return unicode URLs r=Gijs - fixing the hostName in getWindowInfo fixes the issue across the PageInfo panel - fixing docInfo.referrer also fixes the Referring URL on the General tab MozReview-Commit-ID: 9x9uWp2R3Yj
browser/base/content/content.js
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -1187,28 +1187,36 @@ var PageInfoListener = {
   },
 
   getWindowInfo(window) {
     let windowInfo = {};
     windowInfo.isTopWindow = window == window.top;
 
     let hostName = null;
     try {
-      hostName = window.location.host;
+      hostName = Services.io.newURI(window.location.href).displayHost;
     } catch (exception) { }
 
     windowInfo.hostName = hostName;
     return windowInfo;
   },
 
   getDocumentInfo(document) {
     let docInfo = {};
     docInfo.title = document.title;
     docInfo.location = document.location.toString();
+    try {
+      docInfo.location = Services.io.newURI(document.location.toString()).displaySpec;
+    } catch (exception) { }
     docInfo.referrer = document.referrer;
+    try {
+      if (document.referrer) {
+        docInfo.referrer = Services.io.newURI(document.referrer).displaySpec;
+      }
+    } catch (exception) { }
     docInfo.compatMode = document.compatMode;
     docInfo.contentType = document.contentType;
     docInfo.characterSet = document.characterSet;
     docInfo.lastModified = document.lastModified;
     docInfo.principal = document.nodePrincipal;
 
     let documentURIObject = {};
     documentURIObject.spec = document.documentURIObject.spec;