From 4761223002228b1229bdc60a5bb8b3062c757fb3 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Sat, 1 Jul 2006 17:12:03 +0000 Subject: [PATCH] Bug 341437: No user feedback when adding new search engine fails URL checks, patch by Michael Wu , r=me/mconnor --- browser/components/sidebar/src/nsSidebar.js | 10 ++++++++++ browser/locales/en-US/chrome/browser/search.properties | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/browser/components/sidebar/src/nsSidebar.js b/browser/components/sidebar/src/nsSidebar.js index ad225566c80..a0b53c8b4f3 100644 --- a/browser/components/sidebar/src/nsSidebar.js +++ b/browser/components/sidebar/src/nsSidebar.js @@ -205,6 +205,16 @@ function (engineURL, iconURL) { debug(ex); Components.utils.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex); + + var searchBundle = srGetStrBundle("chrome://browser/locale/search.properties"); + var brandBundle = srGetStrBundle("chrome://branding/locale/brand.properties"); + var brandName = brandBundle.GetStringFromName("brandShortName"); + var title = searchBundle.GetStringFromName("error_invalid_engine_title"); + var msg = searchBundle.formatStringFromName("error_invalid_engine_msg", + [brandName], 1); + var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]. + getService(Components.interfaces.nsIWindowWatcher); + ww.getNewPrompter(null).alert(title, msg); return false; } diff --git a/browser/locales/en-US/chrome/browser/search.properties b/browser/locales/en-US/chrome/browser/search.properties index 66c6636c444..4bf633a5bad 100755 --- a/browser/locales/en-US/chrome/browser/search.properties +++ b/browser/locales/en-US/chrome/browser/search.properties @@ -4,7 +4,9 @@ cmd_clearHistory=Clear Search History cmd_clearHistory_accesskey=C error_loading_engine_title=Download Error -error_loading_engine_msg=%S could not download the search plugin from:\n%S\n\nPlease try again or contact the author. +error_loading_engine_msg=%S could not download the search plugin from:\n%S +error_invalid_engine_title=Install Error +error_invalid_engine_msg=This search engine isn't supported by %S and can't be installed. cmd_addFoundEngine=Add "%S"