diff --git a/browser/base/content/test/performance/browser_preferences_usage.js b/browser/base/content/test/performance/browser_preferences_usage.js index 070ae52bd104..e895dd53ff24 100644 --- a/browser/base/content/test/performance/browser_preferences_usage.js +++ b/browser/base/content/test/performance/browser_preferences_usage.js @@ -81,10 +81,6 @@ add_task(async function startup() { min: 135, max: 170, }, - "browser.search.log": { - min: 100, - max: 214, - }, "layout.css.dpi": { min: 45, max: 75, diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index 0a88a2ae845d..d0d9e8e1ac1c 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -28,6 +28,7 @@ XPCOMUtils.defineLazyServiceGetters(this, { const BROWSER_SEARCH_PREF = "browser.search."; XPCOMUtils.defineLazyPreferenceGetter(this, "resetStatus", BROWSER_SEARCH_PREF + "reset.status", ""); +XPCOMUtils.defineLazyPreferenceGetter(this, "loggingEnabled", BROWSER_SEARCH_PREF + "log", false); XPCOMUtils.defineLazyGetter(this, "resetEnabled", () => { return Services.prefs.getDefaultBranch(BROWSER_SEARCH_PREF).getBoolPref("reset.enabled"); }); @@ -195,25 +196,11 @@ const SEARCH_LOG_PREFIX = "*** Search: "; /** * Outputs aText to the JavaScript console as well as to stdout. */ -function DO_LOG(aText) { - dump(SEARCH_LOG_PREFIX + aText + "\n"); - Services.console.logStringMessage(aText); -} - -/** - * In debug builds, use a live, pref-based (browser.search.log) LOG function - * to allow enabling/disabling without a restart. Otherwise, don't log at all by - * default. This can be overridden at startup by the pref, see SearchService's - * _init method. - */ -var LOG = function() {}; - -if (AppConstants.DEBUG) { - LOG = function(aText) { - if (getBoolPref(BROWSER_SEARCH_PREF + "log", false)) { - DO_LOG(aText); - } - }; +function LOG(aText) { + if (loggingEnabled) { + dump(SEARCH_LOG_PREFIX + aText + "\n"); + Services.console.logStringMessage(aText); + } } /** @@ -2578,10 +2565,6 @@ function checkForSyncCompletion(aPromise) { // nsIBrowserSearchService function SearchService() { - // Replace empty LOG function with the useful one if the log pref is set. - if (getBoolPref(BROWSER_SEARCH_PREF + "log", false)) - LOG = DO_LOG; - this._initObservers = PromiseUtils.defer(); }