From 7d60734a4a4e8d687afc84e47c917163f7ddae5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Wed, 27 May 2015 12:45:49 +0200 Subject: [PATCH] Bug 1167146 - Use the displayOrigin option for the web app installation notification. r=myk --HG-- extra : rebase_source : d3e2c10effb02b5f215642fdf84e119a75137966 --- .../en-US/chrome/browser/browser.properties | 6 ++--- browser/modules/WebappManager.jsm | 25 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 8765e25a3d01..e2cf8f7bb45d 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -488,8 +488,8 @@ processHang.button.accessKey = O # Webapps notification popup webapps.install = Install webapps.install.accesskey = I -#LOCALIZATION NOTE (webapps.requestInstall) %1$S is the web app name, %2$S is the site from which the web app is installed -webapps.requestInstall = Do you want to install "%1$S" from this site (%2$S)? +#LOCALIZATION NOTE (webapps.requestInstall2) %S is the web app name +webapps.requestInstall2 = Do you want to install ā€œ%Sā€ from this site? webapps.install.success = Application Installed webapps.install.inprogress = Installation in progress webapps.uninstall = Uninstall @@ -497,7 +497,7 @@ webapps.uninstall.accesskey = U webapps.doNotUninstall = Don't Uninstall webapps.doNotUninstall.accesskey = D #LOCALIZATION NOTE (webapps.requestUninstall) %1$S is the web app name -webapps.requestUninstall = Do you want to uninstall "%1$S"? +webapps.requestUninstall = Do you want to uninstall ā€œ%1$Sā€? # LOCALIZATION NOTE (fullscreen.entered): displayed when we enter HTML5 fullscreen mode, %S is the domain name of the focused website (e.g. mozilla.com). fullscreen.entered=%S is now fullscreen. diff --git a/browser/modules/WebappManager.jsm b/browser/modules/WebappManager.jsm index 28d754730264..b739f792a3e9 100644 --- a/browser/modules/WebappManager.jsm +++ b/browser/modules/WebappManager.jsm @@ -207,17 +207,16 @@ this.WebappManager = { let app = aData.app; let manifest = new ManifestHelper(jsonManifest, app.origin, app.manifestURL); - let host; + let options = {}; try { - host = requestingURI.host; + options.displayOrigin = requestingURI.host; } catch(e) { - host = requestingURI.spec; + options.displayOrigin = requestingURI.spec; } - let message = bundle.getFormattedString("webapps.requestInstall", - [manifest.name, host], 2); + let message = bundle.getFormattedString("webapps.requestInstall2", + [manifest.name]); - let eventCallback = null; let gBrowser = chromeWin.gBrowser; if (gBrowser) { let windowID = aData.oid; @@ -232,14 +231,14 @@ this.WebappManager = { gBrowser.addProgressListener(listener); - eventCallback = (event) => { + options.eventCallback = event => { if (event != "removed") { return; } // The notification was removed, so we should // remove our listener. gBrowser.removeProgressListener(listener); - } + }; } notification = chromeWin.PopupNotifications.show(aBrowser, @@ -247,7 +246,7 @@ this.WebappManager = { message, "webapps-notification-icon", mainAction, [], - eventCallback); + options); }, doUninstall: function(aData, aBrowser) { @@ -284,7 +283,7 @@ this.WebappManager = { [manifest.name]); - let eventCallback = null; + let options = {}; let gBrowser = chromeWin.gBrowser; if (gBrowser) { let windowID = aData.oid; @@ -299,21 +298,21 @@ this.WebappManager = { gBrowser.addProgressListener(listener); - eventCallback = (event) => { + options.eventCallback = event => { if (event != "removed") { return; } // The notification was removed, so we should // remove our listener. gBrowser.removeProgressListener(listener); - } + }; } notification = chromeWin.PopupNotifications.show( aBrowser, "webapps-uninstall", message, "webapps-notification-icon", mainAction, [secondaryAction], - eventCallback); + options); } }