Bug 1391421 - Part 7 - Switch addon/theme install prompts to Unicode domains. r=jwu
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 15 Sep 2017 20:38:08 +0200
changeset 431575 77084cd51869771c19d8c8e5af2ea13ce3cf66c8
parent 431574 7707e5ec573c6bfadde7e3e7812a56603bbc38e8
child 431576 3cb0b289475c028cc9c532ed277e74d09946f906
push id7785
push userryanvm@gmail.com
push dateThu, 21 Sep 2017 13:39:55 +0000
treeherdermozilla-beta@06d4034a8a03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwu
bugs1391421
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 {