Bug 1046885 - Disable installing webapps in guest mode profiles. r=myk

This commit is contained in:
Wes Johnston 2014-08-25 12:55:18 -07:00
parent e126ede3c2
commit d2c853240d
3 changed files with 15 additions and 0 deletions

View File

@ -2517,6 +2517,9 @@ public class BrowserApp extends GeckoApp
final boolean inGuestMode = GeckoProfile.get(this).inGuestMode();
share.setVisible(!inGuestMode);
share.setEnabled(StringUtils.isShareableUrl(url) && !inGuestMode);
MenuUtils.safeSetEnabled(aMenu, R.id.apps, !inGuestMode);
MenuUtils.safeSetEnabled(aMenu, R.id.addons, !inGuestMode);
MenuUtils.safeSetEnabled(aMenu, R.id.downloads, !inGuestMode);
// NOTE: Use MenuUtils.safeSetEnabled because some actions might
// be on the BrowserToolbar context menu

View File

@ -55,3 +55,5 @@ retrievalFailedTitle=#1 update failed;#1 updates failed
# %1$S is a comma-separated list of apps for which retrieval failed.
# example: Failed to retrieve updates for Foo, Bar, Baz
retrievalFailedMessage=Failed to retrieve update for %1$S;Failed to retrieve updates for %1$S
webappsDisabledInGuest=Installing apps is disabled in guest sessions

View File

@ -89,6 +89,12 @@ this.WebappManager = {
},
_installApk: function(aMessage, aMessageManager) { return Task.spawn((function*() {
if (this.inGuestSession()) {
aMessage.error = Strings.GetStringFromName("webappsDisabledInGuest"),
aMessageManager.sendAsyncMessage("Webapps:Install:Return:KO", aMessage);
return;
}
let filePath;
try {
@ -251,6 +257,10 @@ this.WebappManager = {
}),
inGuestSession: function() {
return Services.wm.getMostRecentWindow("navigator:browser").BrowserApp.isGuest;
},
autoInstall: function(aData) {
debug("autoInstall " + aData.manifestURL);