Bug 1418131: Part 3 - Add Windows Security Center info to telemetry environment; r=gfritzsche

MozReview-Commit-ID: 3Cw7XIrROTn

--HG--
extra : rebase_source : 9ad5271118bc22c5c39a3fbddf25f06f864dfa73
This commit is contained in:
Aaron Klotz 2017-11-16 18:10:41 -07:00
parent 29af430043
commit 96d8c20714
3 changed files with 54 additions and 0 deletions

View File

@ -1597,6 +1597,31 @@ EnvironmentCache.prototype = {
};
},
/**
* Get registered security product information.
* @return Object containing the security product data
*/
_getSecurityAppData() {
const maxStringLength = 256;
const keys = [ ["registeredAntiVirus", "antivirus"],
["registeredAntiSpyware", "antispyware"],
["registeredFirewall", "firewall"] ];
let result = {};
for (let [inKey, outKey] of keys) {
let prop = getSysinfoProperty(inKey, null);
if (prop) {
prop = limitStringToLength(prop, maxStringLength).split(";");
}
result[outKey] = prop;
}
return result;
},
/**
* Get the GFX information.
* @return Object containing the GFX data.
@ -1684,6 +1709,11 @@ EnvironmentCache.prototype = {
data.device = this._getDeviceData();
}
// Windows 8+
if (AppConstants.isPlatformAndVersionAtLeast("win", "6.2")) {
data.sec = this._getSecurityAppData();
}
return data;
},

View File

@ -202,6 +202,11 @@ Structure:
},
},
appleModelId: <string>, // Mac only or null on failure
sec: { // This feature is Windows 8+ only
antivirus: [ <string>, ... ], // null if unavailable on platform: Product name(s) of registered antivirus programs
antispyware: [ <string>, ... ], // null if unavailable on platform: Product name(s) of registered antispyware programs
firewall: [ <string>, ... ], // null if unavailable on platform: Product name(s) of registered firewall programs
},
},
addons: {
activeAddons: { // the currently enabled add-ons

View File

@ -666,6 +666,25 @@ function checkSystemSection(data) {
} else {
Assert.ok(checkNullOrString(data.system.appleModelId));
}
// This feature is only available on Windows 8+
if (AppConstants.isPlatformAndVersionAtLeast("win", "6.2")) {
Assert.ok("sec" in data.system, "sec must be available under data.system");
let SEC_FIELDS = ["antivirus", "antispyware", "firewall"];
for (let f of SEC_FIELDS) {
Assert.ok(f in data.system.sec, f + " must be available under data.system.sec");
let value = data.system.sec[f];
// value is null on Windows Server
Assert.ok(value === null || Array.isArray(value), f + " must be either null or an array");
if (Array.isArray(value)) {
for (let product of value) {
Assert.equal(typeof product, "string", "Each element of " + f + " must be a string");
}
}
}
}
}
function checkActiveAddon(data, partialRecord) {