diff options
Diffstat (limited to 'browser/components/StartupRecorder.sys.mjs')
-rw-r--r-- | browser/components/StartupRecorder.sys.mjs | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/browser/components/StartupRecorder.sys.mjs b/browser/components/StartupRecorder.sys.mjs index 7b69b52690..bdc08ee6dd 100644 --- a/browser/components/StartupRecorder.sys.mjs +++ b/browser/components/StartupRecorder.sys.mjs @@ -6,6 +6,23 @@ const Cm = Components.manager; Cm.QueryInterface(Ci.nsIServiceManager); import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; + +const lazy = {}; + +XPCOMUtils.defineLazyPreferenceGetter( + lazy, + "BROWSER_STARTUP_RECORD", + "browser.startup.record", + false +); + +XPCOMUtils.defineLazyPreferenceGetter( + lazy, + "BROWSER_STARTUP_RECORD_IMAGES", + "browser.startup.recordImages", + false +); let firstPaintNotification = "widget-first-paint"; // widget-first-paint fires much later than expected on Linux. @@ -98,10 +115,7 @@ StartupRecorder.prototype = { return; } - if ( - !Services.prefs.getBoolPref("browser.startup.record", false) && - !Services.prefs.getBoolPref("browser.startup.recordImages", false) - ) { + if (!lazy.BROWSER_STARTUP_RECORD && !lazy.BROWSER_STARTUP_RECORD_IMAGES) { this._resolve(); this._resolve = null; return; @@ -118,7 +132,7 @@ StartupRecorder.prototype = { "browser-startup-idle-tasks-finished", ]; - if (Services.prefs.getBoolPref("browser.startup.recordImages", false)) { + if (lazy.BROWSER_STARTUP_RECORD_IMAGES) { // For code simplicify, recording images excludes the other startup // recorder behaviors, so we can observe only the image topics. topics = [ @@ -180,7 +194,7 @@ StartupRecorder.prototype = { this.record.bind(this, "before handling user events") ); } else if (topic == "browser-startup-idle-tasks-finished") { - if (Services.prefs.getBoolPref("browser.startup.recordImages", false)) { + if (lazy.BROWSER_STARTUP_RECORD_IMAGES) { Services.obs.removeObserver(this, "image-drawing"); Services.obs.removeObserver(this, "image-loading"); this._resolve(); |