summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/FirstStartup.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/modules/FirstStartup.sys.mjs
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/FirstStartup.sys.mjs')
-rw-r--r--toolkit/modules/FirstStartup.sys.mjs26
1 files changed, 25 insertions, 1 deletions
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;
+ },
};