Bug 776677 - Show a toast when we receive webapp install errors. r=mfinkle

This commit is contained in:
Wes Johnston 2012-08-08 12:35:15 -07:00
Родитель eb6d34f7a0
Коммит 76e25801f0
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -5913,6 +5913,7 @@ var WebappsUI = {
Services.obs.addObserver(this, "webapps-launch", false);
Services.obs.addObserver(this, "webapps-sync-install", false);
Services.obs.addObserver(this, "webapps-sync-uninstall", false);
Services.obs.addObserver(this, "webapps-install-error", false);
},
uninit: function unint() {
@ -5920,13 +5921,33 @@ var WebappsUI = {
Services.obs.removeObserver(this, "webapps-launch");
Services.obs.removeObserver(this, "webapps-sync-install");
Services.obs.removeObserver(this, "webapps-sync-uninstall");
Services.obs.removeObserver(this, "webapps-install-error", false);
},
DEFAULT_PREFS_FILENAME: "default-prefs.js",
observe: function observe(aSubject, aTopic, aData) {
let data = JSON.parse(aData);
let data = {};
try { data = JSON.parse(aData); }
catch(ex) { }
switch (aTopic) {
case "webapps-install-error":
let msg = "";
switch (aData) {
case "INVALID_MANIFEST":
case "MANIFEST_PARSE_ERROR":
msg = Strings.browser.GetStringFromName("webapps.manifestInstallError");
break;
case "NETWORK_ERROR":
case "MANIFEST_URL_ERROR":
msg = Strings.browser.GetStringFromName("webapps.networkInstallError");
break;
default:
msg = Strings.browser.GetStringFromName("webapps.installError");
}
NativeWindow.toast.show(msg, "short");
console.log("Error installing app: " + aData);
break;
case "webapps-ask-install":
this.doInstall(data);
break;

Просмотреть файл

@ -241,6 +241,12 @@ timer.end=%1$S: %2$Sms
# Webapps
webapps.installTitle=Install Application
webapps.alertSuccess=Successfully installed
# Shown when there is a generic problem installing an app
webapps.installError=Error installing application
# Shown when there is something wrong with an apps manifest
webapps.manifestInstallError=Invalid application manifest
# Shown when a network error prevented installing an app
webapps.networkInstallError=Could not download manifest
# Click to play plugins
clickToPlayPlugins.message1=%S contains plugin content. Would you like to play it?