зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1659842 - Make normandy.liveTelemetry accessible from consolidated targeting r=andreio
Differential Revision: https://phabricator.services.mozilla.com/D87521
This commit is contained in:
Родитель
e116198cc4
Коммит
ff83a641c9
|
@ -1,3 +1,6 @@
|
|||
const { ClientEnvironment } = ChromeUtils.import(
|
||||
"resource://normandy/lib/ClientEnvironment.jsm"
|
||||
);
|
||||
const { TargetingContext } = ChromeUtils.import(
|
||||
"resource://messaging-system/targeting/Targeting.jsm"
|
||||
);
|
||||
|
@ -204,3 +207,13 @@ add_task(async function test_telemetry_event_error() {
|
|||
TelemetryTestUtils.assertEvents(expectedEvents);
|
||||
Services.telemetry.clearEvents();
|
||||
});
|
||||
|
||||
// Make sure that when using the Normandy-style ClientEnvironment context,
|
||||
// `liveTelemetry` works. `liveTelemetry` is a particularly tricky object to
|
||||
// proxy, so it's useful to check specifically.
|
||||
add_task(async function test_live_telemetry() {
|
||||
let ctx = { env: ClientEnvironment };
|
||||
let targeting = new TargetingContext();
|
||||
// This shouldn't throw.
|
||||
await targeting.eval("env.liveTelemetry.main", ctx);
|
||||
});
|
||||
|
|
|
@ -16,7 +16,6 @@ ChromeUtils.defineModuleGetter(this, "AppConstants", "resource://gre/modules/App
|
|||
ChromeUtils.defineModuleGetter(this, "AttributionCode", "resource:///modules/AttributionCode.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "WindowsVersionInfo", "resource://gre/modules/components-utils/WindowsVersionInfo.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "NormandyUtils", "resource://normandy/lib/NormandyUtils.jsm");
|
||||
|
||||
/* eslint-enable prettier/prettier */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ClientEnvironmentBase"];
|
||||
|
@ -82,6 +81,10 @@ class ClientEnvironmentBase {
|
|||
if (prop == "main") {
|
||||
return target.main;
|
||||
}
|
||||
if (prop == "then") {
|
||||
// this isn't a Promise, but it's not a problem to check
|
||||
return undefined;
|
||||
}
|
||||
throw new Error(
|
||||
`Live telemetry only includes the main ping, not the ${prop} ping`
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче