Bug 937769 - JS Error: Error in invoking addEngine, no onError. r=lucasr

This commit is contained in:
Chenxia Liu 2013-11-18 10:17:46 -08:00
parent a8bef97fb1
commit 6ab2e3f60c
2 changed files with 17 additions and 1 deletions

View File

@ -6799,6 +6799,20 @@ var SearchEngines = {
onSuccess: function() {
// Display a toast confirming addition of new search engine.
NativeWindow.toast.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [engine.title], 1), "long");
},
onError: function(aCode) {
let errorMessage;
if (aCode == 2) {
// Engine is a duplicate.
errorMessage = "alertSearchEngineDuplicateToast";
} else {
// Unknown failure. Display general error message.
errorMessage = "alertSearchEngineErrorToast";
}
NativeWindow.toast.show(Strings.browser.formatStringFromName(errorMessage, [engine.title], 1), "long");
}
});
},

View File

@ -22,10 +22,12 @@ alertDownloadsCancel=Cancel
alertFullScreenToast=Press BACK to leave full-screen mode
# LOCALIZATION NOTE (alertSearchEngineAddedToast)
# LOCALIZATION NOTE (alertSearchEngineAddedToast, alertSearchEngineErrorToast, alertSearchEngineDuplicateToast)
# %S will be replaced by the name of the search engine (exposed by the current page)
# that has been added; for example, 'Google'.
alertSearchEngineAddedToast='%S' has been added as a search engine
alertSearchEngineErrorToast=Couldn't add '%S' as a search engine
alertSearchEngineDuplicateToast='%S' is already one of your search engines
downloadCancelPromptTitle=Cancel Download
downloadCancelPromptMessage=Do you want to cancel this download?