From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- toolkit/modules/FirstStartup.sys.mjs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'toolkit/modules/FirstStartup.sys.mjs') diff --git a/toolkit/modules/FirstStartup.sys.mjs b/toolkit/modules/FirstStartup.sys.mjs index b31e7ffa07..c09885abe9 100644 --- a/toolkit/modules/FirstStartup.sys.mjs +++ b/toolkit/modules/FirstStartup.sys.mjs @@ -36,8 +36,25 @@ export var FirstStartup = { * completed, or until a timeout is reached. * * In the latter case, services are expected to run post-UI instead as usual. + * + * @param {boolean} newProfile + * True if a new profile was just created, false otherwise. */ - init() { + init(newProfile) { + if (!newProfile) { + // In this case, we actually don't want to do any FirstStartup work, + // since a pre-existing profile was detected (presumably, we entered here + // because a user re-installed via the stub installer when there existed + // previous user profiles on the file system). We do, however, want to + // measure how often this occurs. + Glean.firstStartup.statusCode.set(this.NOT_STARTED); + Glean.firstStartup.newProfile.set(false); + GleanPings.firstStartup.submit(); + return; + } + + Glean.firstStartup.newProfile.set(true); + this._state = this.IN_PROGRESS; const timeout = Services.prefs.getIntPref(PREF_TIMEOUT, 30000); // default to 30 seconds let startingTime = Cu.now(); @@ -106,4 +123,11 @@ export var FirstStartup = { get state() { return this._state; }, + + /** + * For testing only. This puts us back into the initial NOT_STARTED state. + */ + resetForTesting() { + this._state = this.NOT_STARTED; + }, }; -- cgit v1.2.3