Bug 1578885 - use AttributionCode directly from ClientEnvironment, rather than Telemetry r=leplatrem

Differential Revision: https://phabricator.services.mozilla.com/D45433

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Robert Helmer 2019-09-13 14:21:14 +00:00
parent 9a9c5a8311
commit ab637aa92b
2 changed files with 23 additions and 1 deletions

View File

@ -42,6 +42,12 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/FirstStartup.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"AttributionCode",
"resource:///modules/AttributionCode.jsm"
);
var EXPORTED_SYMBOLS = ["ClientEnvironmentBase"];
/**
@ -217,4 +223,8 @@ class ClientEnvironmentBase {
return rv;
})();
}
static get attribution() {
return AttributionCode.getAttrDataAsync();
}
}

View File

@ -44,7 +44,7 @@ add_task(async () => {
equal(os.darwinVersion, null, "Darwin version should not be set");
}
// if on Mac, Mac versions should be set, and Windows versions should not b e
// if on Mac, Mac versions should be set, and Windows versions should not be
if (os.isMac) {
equal(typeof os.macVersion, "number", "Mac version should be a number");
equal(
@ -72,3 +72,15 @@ add_task(async () => {
);
}
});
add_task(async () => {
try {
await ClientEnvironmentBase.attribution;
} catch (ex) {
equal(
ex.name,
"NS_ERROR_FILE_NOT_FOUND",
"Test environment does not have attribution data"
);
}
});