summaryrefslogtreecommitdiffstats
path: root/toolkit/components/nimbus/lib/ExperimentManager.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /toolkit/components/nimbus/lib/ExperimentManager.sys.mjs
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/nimbus/lib/ExperimentManager.sys.mjs')
-rw-r--r--toolkit/components/nimbus/lib/ExperimentManager.sys.mjs21
1 files changed, 17 insertions, 4 deletions
diff --git a/toolkit/components/nimbus/lib/ExperimentManager.sys.mjs b/toolkit/components/nimbus/lib/ExperimentManager.sys.mjs
index d0f313a2ae..8bd847b067 100644
--- a/toolkit/components/nimbus/lib/ExperimentManager.sys.mjs
+++ b/toolkit/components/nimbus/lib/ExperimentManager.sys.mjs
@@ -95,8 +95,8 @@ export class _ExperimentManager {
get studiesEnabled() {
return (
- Services.prefs.getBoolPref(UPLOAD_ENABLED_PREF) &&
- Services.prefs.getBoolPref(STUDIES_OPT_OUT_PREF)
+ Services.prefs.getBoolPref(UPLOAD_ENABLED_PREF, false) &&
+ Services.prefs.getBoolPref(STUDIES_OPT_OUT_PREF, false)
);
}
@@ -974,7 +974,7 @@ export class _ExperimentManager {
// need to check if we have another enrollment for the same feature.
const conflictingEnrollment = getConflictingEnrollment(featureId);
- for (const [variable, value] of Object.entries(featureValue)) {
+ for (let [variable, value] of Object.entries(featureValue)) {
const setPref = feature.getSetPref(variable);
if (setPref) {
@@ -1012,6 +1012,13 @@ export class _ExperimentManager {
// An experiment takes precedence if there is already a pref set.
if (!isRollout || !conflictingPref) {
+ if (
+ lazy.NimbusFeatures[featureId].manifest.variables[variable]
+ .type === "json"
+ ) {
+ value = JSON.stringify(value);
+ }
+
prefsToSet.push({
name: prefName,
value,
@@ -1250,7 +1257,13 @@ export class _ExperimentManager {
}
}
- const value = featuresById[featureId].value[variable];
+ let value = featuresById[featureId].value[variable];
+ if (
+ lazy.NimbusFeatures[featureId].manifest.variables[variable].type ===
+ "json"
+ ) {
+ value = JSON.stringify(value);
+ }
if (prefBranch !== "user") {
lazy.PrefUtils.setPref(name, value, { branch: prefBranch });