Bug 856131 - Regression: No Android home-screen shortcut created on app install. r=fabrice

This commit is contained in:
James Hugman 2013-05-09 08:20:37 -07:00
parent dd012231fb
commit f852f7f567
2 changed files with 30 additions and 16 deletions

View File

@ -1869,7 +1869,7 @@ this.DOMApplicationRegistry = {
confirmInstall: function(aData, aFromSync, aProfileDir,
aOfflineCacheObserver,
aZipDownloadSuccessCallback) {
aInstallSuccessCallback) {
let isReinstall = false;
let app = aData.app;
app.removable = true;
@ -1978,15 +1978,23 @@ this.DOMApplicationRegistry = {
offlineCacheObserver: aOfflineCacheObserver
}
if (!aFromSync)
this._saveApps((function() {
this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
this.broadcastMessage("Webapps:Install:Return:OK", aData);
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
}).bind(this));
let postFirstInstallTask = (function () {
// Only executed on install not involving sync.
this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
this.broadcastMessage("Webapps:Install:Return:OK", aData);
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
}).bind(this);
if (!aData.isPackage) {
if (!aFromSync) {
this._saveApps((function() {
postFirstInstallTask();
}).bind(this));
}
this.updateAppHandlers(null, app.manifest, app);
if (aInstallSuccessCallback) {
aInstallSuccessCallback(manifest);
}
}
if (manifest.package_path) {
@ -2026,8 +2034,11 @@ this.DOMApplicationRegistry = {
manifestURL: appObject.manifestURL,
app: app,
manifest: aManifest });
if (aZipDownloadSuccessCallback) {
aZipDownloadSuccessCallback(aManifest);
if (!aFromSync) {
postFirstInstallTask();
}
if (aInstallSuccessCallback) {
aInstallSuccessCallback(aManifest);
}
}).bind(this));
}).bind(this));

View File

@ -6225,13 +6225,16 @@ var WebappsUI = {
origin: aData.app.origin,
iconURL: fullsizeIcon
});
let message = Strings.browser.GetStringFromName("webapps.alertSuccess");
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
alerts.showAlertNotification("drawable://alert_app", manifest.name, message, true, "", {
observe: function () {
self.openURL(aData.app.manifestURL, aData.app.origin);
}
}, "webapp");
if (!!aData.isPackage) {
// For packaged apps, put a notification in the notification bar.
let message = Strings.browser.GetStringFromName("webapps.alertSuccess");
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
alerts.showAlertNotification("drawable://alert_app", manifest.name, message, true, "", {
observe: function () {
self.openURL(aData.app.manifestURL, aData.app.origin);
}
}, "webapp");
}
} catch(ex) {
console.log(ex);
}