From 935768b34944e8d0747fb3fb5e04fa1bedd3f40b Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Wed, 10 Jul 2013 14:35:30 -0700 Subject: [PATCH] Bug 890085: don't throw in the currentEngine/defaultEngine setters if the defaultenginename pref is invalid, r=mikedeboer --HG-- extra : transplant_source : I%18%BA%EB%E8%B1%95V%FA%BF%FA%F5L%14%60%BD%FC%A2DK --- toolkit/components/search/nsSearchService.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index cb9d4d0af64b..e2fe0321eb32 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -2681,7 +2681,13 @@ SearchService.prototype = { get _originalDefaultEngine() { let defaultPrefB = Services.prefs.getDefaultBranch(BROWSER_SEARCH_PREF); let nsIPLS = Ci.nsIPrefLocalizedString; - let defaultEngine = defaultPrefB.getComplexValue("defaultenginename", nsIPLS).data; + let defaultEngine; + try { + defaultEngine = defaultPrefB.getComplexValue("defaultenginename", nsIPLS).data; + } catch (ex) { + // If the default pref is invalid (e.g. an add-on set it to a bogus value) + // getEngineByName will just return null, which is the best we can do. + } return this.getEngineByName(defaultEngine); },