Bug 1373093 - Add operating system information to the desktop Sync ping. r=tcsc

MozReview-Commit-ID: 9ypnosSawxu

--HG--
extra : rebase_source : 8a0192c70917c952431693c6864f96f7fd9b278e
This commit is contained in:
Mark Hammond 2017-06-21 12:28:25 +10:00
Родитель c5d41dbbc6
Коммит 7e61aa8e97
4 изменённых файлов: 13 добавлений и 1 удалений

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

@ -26,6 +26,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryUtils",
"resource://gre/modules/TelemetryUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment",
"resource://gre/modules/TelemetryEnvironment.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
@ -442,6 +444,7 @@ class SyncTelemetryImpl {
getPingJSON(reason) {
return {
os: TelemetryEnvironment.currentEnvironment["system"]["os"],
why: reason,
discarded: this.discarded || undefined,
version: PING_FORMAT_VERSION,

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

@ -6,6 +6,7 @@
"required": ["version", "syncs", "why", "uid"],
"properties": {
"version": { "type": "integer", "minimum": 0 },
"os": { "type": "object" },
"discarded": { "type": "integer", "minimum": 1 },
"why": { "enum": ["shutdown", "schedule", "idchange"] },
"uid": {

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

@ -90,7 +90,14 @@ add_task(async function test_basic() {
let server = httpd_setup(handlers);
await configureIdentity({ username: "johndoe" }, server);
await sync_and_validate_telem(true);
let ping = await sync_and_validate_telem(true, true);
// Check the "os" block - we can't really check specific values, but can
// check it smells sane.
ok(ping.os, "there is an OS block");
ok("name" in ping.os, "there is an OS name");
ok("version" in ping.os, "there is an OS version");
ok("locale" in ping.os, "there is an OS locale");
Svc.Prefs.resetBranch("");
await promiseStopServer(server);

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

@ -18,6 +18,7 @@ Structure:
... common ping data
payload: {
version: 1,
os : { ... }, // os data from the current telemetry environment. OS specific, but typically includes name, version and locale.
discarded: <integer count> // Number of syncs discarded -- left out if zero.
why: <string>, // Why did we submit the ping? Either "shutdown", "schedule", or "idchanged".
uid: <string>, // Hashed FxA unique ID, or string of 32 zeros. If this changes between syncs, the payload is submitted.