Bug 1391421 - Part 7 - Switch addon/theme install prompts to Unicode domains. r?jwu draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 15 Sep 2017 20:38:08 +0200
changeset 666451 34778d340777831ced52cd60a592251ab7eea14d
parent 666450 dfa4aec27a6c51e106425a485702cee63c1802fa
child 666452 30b692d69f554e136f2bcd386e18b1a565beed18
push id80411
push usermozilla@buttercookie.de
push dateMon, 18 Sep 2017 19:20:36 +0000
reviewersjwu
bugs1391421
milestone57.0a1
Bug 1391421 - Part 7 - Switch addon/theme install prompts to Unicode domains. r?jwu MozReview-Commit-ID: HlQKTJRu0FT
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3195,17 +3195,19 @@ var LightWeightThemeWebInstaller = {
       return;
 
     if (this._isAllowed(node)) {
       this._install(data);
       return;
     }
 
     let allowButtonText = Strings.browser.GetStringFromName("lwthemeInstallRequest.allowButton");
-    let message = Strings.browser.formatStringFromName("lwthemeInstallRequest.message", [node.ownerDocument.location.hostname], 1);
+    let IDNService = Cc["@mozilla.org/network/idn-service;1"].getService(Ci.nsIIDNService);
+    let hostname = IDNService.convertToDisplayIDN(node.ownerDocument.location.hostname);
+    let message = Strings.browser.formatStringFromName("lwthemeInstallRequest.message", [hostname], 1);
     let buttons = [{
       label: allowButtonText,
       callback: function () {
         LightWeightThemeWebInstaller._install(data);
       },
       positive: true
     }];
 
@@ -4907,17 +4909,17 @@ var XPInstallObserver = {
   },
 
   observe: function(aSubject, aTopic, aData) {
     let installInfo, tab, host;
     if (aSubject && aSubject.wrappedJSObject) {
       installInfo = aSubject.wrappedJSObject;
       tab = BrowserApp.getTabForBrowser(installInfo.browser);
       if (installInfo.originatingURI) {
-        host = installInfo.originatingURI.host;
+        host = installInfo.originatingURI.displayHost;
       }
     }
 
     let strings = Strings.browser;
     let brandShortName = Strings.brand.GetStringFromName("brandShortName");
 
     switch (aTopic) {
       case "addon-install-started":
@@ -5090,19 +5092,19 @@ var XPInstallObserver = {
   _showErrorMessage: function(aInstall) {
     // Don't create a notification for distribution add-ons.
     if (Distribution.pendingAddonInstalls.has(aInstall)) {
       Cu.reportError("Error installing distribution add-on: " + aInstall.addon.id);
       Distribution.pendingAddonInstalls.delete(aInstall);
       return;
     }
 
-    let host = (aInstall.originatingURI instanceof Ci.nsIStandardURL) && aInstall.originatingURI.host;
+    let host = (aInstall.originatingURI instanceof Ci.nsIStandardURL) && aInstall.originatingURI.displayHost;
     if (!host) {
-      host = (aInstall.sourceURI instanceof Ci.nsIStandardURL) && aInstall.sourceURI.host;
+      host = (aInstall.sourceURI instanceof Ci.nsIStandardURL) && aInstall.sourceURI.displayHost;
     }
 
     let error = (host || aInstall.error == 0) ? "addonError" : "addonLocalError";
     if (aInstall.error < 0) {
       error += aInstall.error;
     } else if (aInstall.addon && aInstall.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
       error += "Blocklisted";
     } else {