Bug 1000315 - Part 5: Uninstall prompting on Android (just a stub for now). r=mfinkle

This commit is contained in:
Ted Clancy (:tedders1) 2014-06-11 14:27:06 -07:00
parent 5a16cd2ff0
commit 1e1c4fc0da
2 changed files with 12 additions and 2 deletions

View File

@ -353,6 +353,7 @@ var BrowserApp = {
Services.obs.addObserver(this, "webapps-runtime-install", false);
Services.obs.addObserver(this, "webapps-runtime-install-package", false);
Services.obs.addObserver(this, "webapps-ask-install", false);
Services.obs.addObserver(this, "webapps-ask-uninstall", false);
Services.obs.addObserver(this, "webapps-launch", false);
Services.obs.addObserver(this, "webapps-runtime-uninstall", false);
Services.obs.addObserver(this, "Webapps:AutoInstall", false);
@ -1707,6 +1708,10 @@ var BrowserApp = {
WebappManager.askInstall(JSON.parse(aData));
break;
case "webapps-ask-uninstall":
WebappManager.askUninstall(JSON.parse(aData));
break;
case "webapps-launch": {
WebappManager.launch(JSON.parse(aData));
break;

View File

@ -194,6 +194,12 @@ this.WebappManager = {
});
},
askUninstall: function(aData) {
// Android does not currently support automatic uninstalling of apps.
// See bug 1019054.
DOMApplicationRegistry.denyUninstall(aData, "NOT_SUPPORTED");
},
launch: function({ apkPackageName }) {
debug("launch: " + apkPackageName);
@ -633,8 +639,7 @@ this.WebappManager = {
let app = DOMApplicationRegistry.webapps[id];
if (aData.apkPackageNames.indexOf(app.apkPackageName) > -1) {
debug("attempting to uninstall " + app.name);
DOMApplicationRegistry.uninstall(
app.manifestURL,
DOMApplicationRegistry.uninstall(app.manifestURL).then(
function() {
debug("success uninstalling " + app.name);
},