Bug 1728990 - Require exposure event description in FeatureManifest r=k88hudson

Differential Revision: https://phabricator.services.mozilla.com/D124657
This commit is contained in:
Andrei Oprea 2021-09-09 13:43:05 +00:00
Родитель 512463417e
Коммит b9096de8d8
4 изменённых файлов: 29 добавлений и 2 удалений

Просмотреть файл

@ -13,6 +13,8 @@ const EXPORTED_SYMBOLS = ["FeatureManifest"];
const FeatureManifest = {
urlbar: {
description: "The Address Bar",
exposureDescription:
"Exposure is sent once per browsing session after the first urlbar query is made.",
variables: {
merinoEnabled: {
type: "boolean",
@ -66,6 +68,8 @@ const FeatureManifest = {
},
aboutwelcome: {
description: "The about:welcome page",
exposureDescription:
"Exposure is sent once per browsing session when the about:welcome URL is first accessed.",
isEarlyStartup: true,
variables: {
enabled: {
@ -93,6 +97,7 @@ const FeatureManifest = {
},
abouthomecache: {
description: "The startup about:home cache.",
exposureDescription: false,
isEarlyStartup: true,
variables: {
enabled: {
@ -104,6 +109,7 @@ const FeatureManifest = {
},
firefox100: {
description: "Firefox User-Agent version",
exposureDescription: false,
isEarlyStartup: true,
variables: {
firefoxVersion: {
@ -114,6 +120,8 @@ const FeatureManifest = {
},
newtab: {
description: "The about:newtab page",
exposureDescription:
"Exposure is sent once per browsing session when the first newtab page loads (either about:newtab or about:home).",
isEarlyStartup: true,
variables: {
customizationMenuEnabled: {
@ -130,6 +138,7 @@ const FeatureManifest = {
},
pocketNewtab: {
description: "The Pocket section in newtab",
exposureDescription: false,
isEarlyStartup: true,
variables: {
spocPositions: {
@ -142,6 +151,7 @@ const FeatureManifest = {
},
"password-autocomplete": {
description: "A special autocomplete UI for password fields.",
exposureDescription: false,
variables: {
directMigrateSingleProfile: {
type: "boolean",
@ -151,6 +161,7 @@ const FeatureManifest = {
},
shellService: {
description: "Interface with OS, e.g., pinning and set default",
exposureDescription: false,
isEarlyStartup: true,
variables: {
disablePin: {
@ -166,6 +177,7 @@ const FeatureManifest = {
},
upgradeDialog: {
description: "The dialog shown for major upgrades",
exposureDescription: false,
isEarlyStartup: true,
variables: {
enabled: {
@ -177,6 +189,8 @@ const FeatureManifest = {
},
privatebrowsing: {
description: "about:privatebrowsing",
exposureDescription:
"Exposure is sent once per browsing session the first time the PB page loads",
variables: {
infoEnabled: {
type: "boolean",
@ -269,6 +283,7 @@ const FeatureManifest = {
},
readerMode: {
description: "Firefox Reader Mode",
exposureDescription: false,
isEarlyStartup: true,
variables: {
pocketCTAVersion: {

Просмотреть файл

@ -9,6 +9,12 @@
"description": {
"type": "string"
},
"exposureDescription": {
"oneOf": [
{"type": "string"},
{"type": "boolean"}
]
},
"isEarlyStartup": {
"type": "boolean",
"description": "If the feature values should be cached in prefs for fast early startup."
@ -41,7 +47,7 @@
}
}
},
"required": ["description"]
"required": ["description", "exposureDescription"]
}
}
}

Просмотреть файл

@ -82,6 +82,10 @@ add_task(async function test_experiment_enroll_unenroll_Telemetry() {
});
add_task(async function test_experiment_expose_Telemetry() {
const featureManifest = {
description: "Test feature",
exposureDescription: "Used in tests",
};
const cleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "test-feature",
value: { enabled: false },
@ -92,7 +96,7 @@ add_task(async function test_experiment_expose_Telemetry() {
});
const { featureId } = experiment.branch.features[0];
const feature = new ExperimentFeature(featureId);
const feature = new ExperimentFeature(featureId, featureManifest);
Services.telemetry.clearEvents();
feature.recordExposureEvent();

Просмотреть файл

@ -28,6 +28,8 @@ function setDefaultBranch(pref, value) {
const TEST_FALLBACK_PREF = "testprefbranch.config";
const FAKE_FEATURE_MANIFEST = {
description: "Test feature",
exposureDescription: "Used in tests",
variables: {
enabled: {
type: "boolean",