Loading browser/components/newtab/test/browser/browser_aboutwelcome_multistage.js +4 −5 Original line number Diff line number Diff line Loading @@ -322,9 +322,8 @@ add_task(async function test_multistage_zeroOnboarding_experimentAPI() { await setAboutWelcomePref(true); await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: false, featureId: "aboutwelcome", value: null, value: { enabled: false }, }); ExperimentAPI._store._syncToChildren({ flush: true }); Loading Loading @@ -363,10 +362,10 @@ add_task(async function test_multistage_aboutwelcome_experimentAPI() { await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: true, featureId: "aboutwelcome", value: { id: "my-mochitest-experiment", enabled: true, screens: TEST_MULTISTAGE_CONTENT, }, }); Loading Loading @@ -508,10 +507,10 @@ add_task(async function test_multistage_aboutwelcome_transitions() { await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: true, featureId: "aboutwelcome", value: { id: "my-mochitest-experiment", enabled: true, screens: TEST_PROTON_CONTENT, isProton: true, transitions: true, Loading Loading @@ -568,10 +567,10 @@ add_task(async function test_multistage_aboutwelcome_transitions_off() { await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: true, featureId: "aboutwelcome", value: { id: "my-mochitest-experiment", enabled: true, screens: TEST_PROTON_CONTENT, isProton: true, transitions: false, Loading browser/components/newtab/test/browser/browser_aboutwelcome_rtamo.js +2 −3 Original line number Diff line number Diff line Loading @@ -209,11 +209,10 @@ add_task(async function test_rtamo_aboutwelcome() { ); }); add_task(async function test_rtamo_over_experimnts() { add_task(async function test_rtamo_over_experiments() { let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ featureId: "aboutwelcome", enabled: true, value: { screens: [] }, value: { screens: [], enabled: true }, }); let browser = await openRTAMOWelcomePage(); Loading toolkit/components/nimbus/ExperimentAPI.jsm +13 −23 Original line number Diff line number Diff line Loading @@ -315,22 +315,6 @@ class ExperimentFeature { this._listenForRemoteDefaults = this._listenForRemoteDefaults.bind(this); const variables = this.manifest?.variables || {}; // Add special enabled flag if (this.manifest?.enabledFallbackPref) { XPCOMUtils.defineLazyPreferenceGetter( this, "enabled", this.manifest?.enabledFallbackPref, null, () => { ExperimentAPI._store._emitFeatureUpdate( this.featureId, "pref-updated" ); } ); } Object.keys(variables).forEach(key => { const { type, fallbackPref } = variables[key]; if (fallbackPref) { Loading Loading @@ -426,6 +410,18 @@ class ExperimentFeature { * @returns {obj} The feature value */ isEnabled({ sendExposureEvent, defaultValue = null } = {}) { let enabled; try { enabled = this.getVariable("enabled", { sendExposureEvent }); } catch (e) { /* This is expected not all features have an enabled flag defined */ } if (isBooleanValueDefined(enabled)) { return enabled; } // The following code is concerned with backwards compatibility, newer // recipes should return before this part. const branch = ExperimentAPI.activateBranch({ featureId: this.featureId, sendExposureEvent: sendExposureEvent && this._sendExposureEventOnce, Loading @@ -445,12 +441,6 @@ class ExperimentFeature { return this.getRemoteConfig().enabled; } // Then check the fallback pref, if it is defined if (isBooleanValueDefined(this.enabled)) { return this.enabled; } // Finally, return options.defaulValue if neither was found return defaultValue; } Loading Loading @@ -509,7 +499,7 @@ class ExperimentFeature { })?.feature?.value?.[variable]; // Prevent future exposure events if user is enrolled in an experiment if (experimentValue && sendExposureEvent) { if (typeof experimentValue !== "undefined" && sendExposureEvent) { this._sendExposureEventOnce = false; } Loading toolkit/components/nimbus/FeatureManifest.js +10 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,11 @@ const FeatureManifest = { aboutwelcome: { description: "The about:welcome page", isEarlyStartup: true, enabledFallbackPref: "browser.aboutwelcome.enabled", variables: { enabled: { type: "boolean", fallbackPref: "browser.aboutwelcome.enabled", }, screens: { type: "json", fallbackPref: "browser.aboutwelcome.screens", Loading Loading @@ -105,7 +108,12 @@ const FeatureManifest = { upgradeDialog: { description: "The dialog shown for major upgrades", isEarlyStartup: true, enabledFallbackPref: "browser.startup.upgradeDialog.enabled", variables: { enabled: { type: "boolean", fallbackPref: "browser.startup.upgradeDialog.enabled", }, }, }, privatebrowsing: { description: "about:privatebrowsing", Loading toolkit/components/nimbus/schemas/ExperimentFeatureManifest.schema.json +0 −3 Original line number Diff line number Diff line Loading @@ -9,9 +9,6 @@ "description": { "type": "string" }, "enabledFallbackPref": { "type": "string" }, "isEarlyStartup": { "type": "boolean", "description": "If the feature values should be cached in prefs for fast early startup." Loading Loading
browser/components/newtab/test/browser/browser_aboutwelcome_multistage.js +4 −5 Original line number Diff line number Diff line Loading @@ -322,9 +322,8 @@ add_task(async function test_multistage_zeroOnboarding_experimentAPI() { await setAboutWelcomePref(true); await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: false, featureId: "aboutwelcome", value: null, value: { enabled: false }, }); ExperimentAPI._store._syncToChildren({ flush: true }); Loading Loading @@ -363,10 +362,10 @@ add_task(async function test_multistage_aboutwelcome_experimentAPI() { await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: true, featureId: "aboutwelcome", value: { id: "my-mochitest-experiment", enabled: true, screens: TEST_MULTISTAGE_CONTENT, }, }); Loading Loading @@ -508,10 +507,10 @@ add_task(async function test_multistage_aboutwelcome_transitions() { await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: true, featureId: "aboutwelcome", value: { id: "my-mochitest-experiment", enabled: true, screens: TEST_PROTON_CONTENT, isProton: true, transitions: true, Loading Loading @@ -568,10 +567,10 @@ add_task(async function test_multistage_aboutwelcome_transitions_off() { await ExperimentAPI.ready(); let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ enabled: true, featureId: "aboutwelcome", value: { id: "my-mochitest-experiment", enabled: true, screens: TEST_PROTON_CONTENT, isProton: true, transitions: false, Loading
browser/components/newtab/test/browser/browser_aboutwelcome_rtamo.js +2 −3 Original line number Diff line number Diff line Loading @@ -209,11 +209,10 @@ add_task(async function test_rtamo_aboutwelcome() { ); }); add_task(async function test_rtamo_over_experimnts() { add_task(async function test_rtamo_over_experiments() { let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ featureId: "aboutwelcome", enabled: true, value: { screens: [] }, value: { screens: [], enabled: true }, }); let browser = await openRTAMOWelcomePage(); Loading
toolkit/components/nimbus/ExperimentAPI.jsm +13 −23 Original line number Diff line number Diff line Loading @@ -315,22 +315,6 @@ class ExperimentFeature { this._listenForRemoteDefaults = this._listenForRemoteDefaults.bind(this); const variables = this.manifest?.variables || {}; // Add special enabled flag if (this.manifest?.enabledFallbackPref) { XPCOMUtils.defineLazyPreferenceGetter( this, "enabled", this.manifest?.enabledFallbackPref, null, () => { ExperimentAPI._store._emitFeatureUpdate( this.featureId, "pref-updated" ); } ); } Object.keys(variables).forEach(key => { const { type, fallbackPref } = variables[key]; if (fallbackPref) { Loading Loading @@ -426,6 +410,18 @@ class ExperimentFeature { * @returns {obj} The feature value */ isEnabled({ sendExposureEvent, defaultValue = null } = {}) { let enabled; try { enabled = this.getVariable("enabled", { sendExposureEvent }); } catch (e) { /* This is expected not all features have an enabled flag defined */ } if (isBooleanValueDefined(enabled)) { return enabled; } // The following code is concerned with backwards compatibility, newer // recipes should return before this part. const branch = ExperimentAPI.activateBranch({ featureId: this.featureId, sendExposureEvent: sendExposureEvent && this._sendExposureEventOnce, Loading @@ -445,12 +441,6 @@ class ExperimentFeature { return this.getRemoteConfig().enabled; } // Then check the fallback pref, if it is defined if (isBooleanValueDefined(this.enabled)) { return this.enabled; } // Finally, return options.defaulValue if neither was found return defaultValue; } Loading Loading @@ -509,7 +499,7 @@ class ExperimentFeature { })?.feature?.value?.[variable]; // Prevent future exposure events if user is enrolled in an experiment if (experimentValue && sendExposureEvent) { if (typeof experimentValue !== "undefined" && sendExposureEvent) { this._sendExposureEventOnce = false; } Loading
toolkit/components/nimbus/FeatureManifest.js +10 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,11 @@ const FeatureManifest = { aboutwelcome: { description: "The about:welcome page", isEarlyStartup: true, enabledFallbackPref: "browser.aboutwelcome.enabled", variables: { enabled: { type: "boolean", fallbackPref: "browser.aboutwelcome.enabled", }, screens: { type: "json", fallbackPref: "browser.aboutwelcome.screens", Loading Loading @@ -105,7 +108,12 @@ const FeatureManifest = { upgradeDialog: { description: "The dialog shown for major upgrades", isEarlyStartup: true, enabledFallbackPref: "browser.startup.upgradeDialog.enabled", variables: { enabled: { type: "boolean", fallbackPref: "browser.startup.upgradeDialog.enabled", }, }, }, privatebrowsing: { description: "about:privatebrowsing", Loading
toolkit/components/nimbus/schemas/ExperimentFeatureManifest.schema.json +0 −3 Original line number Diff line number Diff line Loading @@ -9,9 +9,6 @@ "description": { "type": "string" }, "enabledFallbackPref": { "type": "string" }, "isEarlyStartup": { "type": "boolean", "description": "If the feature values should be cached in prefs for fast early startup." Loading