Bug 1122052 - Remove duplicated data from TelemetrySession. r=gfritzsche

This commit is contained in:
Alessio Placitelli 2015-02-24 15:11:31 +01:00
parent 281d96cb50
commit 022759f63d
2 changed files with 4 additions and 85 deletions

View File

@ -543,14 +543,12 @@ let Impl = {
let ret = { let ret = {
reason: reason, reason: reason,
OS: ai.OS, OS: ai.OS,
appID: ai.ID, appVersion: ai.version, // TODO: In Environment, but needed for |submissionPath|
appVersion: ai.version, appName: ai.name, // TODO: In Environment, but needed for |submissionPath|
appName: ai.name, appBuildID: ai.appBuildID, // TODO: In Environment, but needed for |submissionPath|
appBuildID: ai.appBuildID, appUpdateChannel: UpdateChannel.get(), // TODO: In Environment, but needed for |submissionPath|
appUpdateChannel: UpdateChannel.get(),
platformBuildID: ai.platformBuildID, platformBuildID: ai.platformBuildID,
revision: HISTOGRAMS_FILE_VERSION, revision: HISTOGRAMS_FILE_VERSION,
locale: getLocale(),
asyncPluginInit: Preferences.get(PREF_ASYNC_PLUGIN_INIT, false) asyncPluginInit: Preferences.get(PREF_ASYNC_PLUGIN_INIT, false)
}; };
@ -565,58 +563,6 @@ let Impl = {
ret.previousBuildID = this._previousBuildID; ret.previousBuildID = this._previousBuildID;
} }
// sysinfo fields are not always available, get what we can.
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
let fields = ["cpucount", "memsize", "arch", "version", "kernel_version",
"device", "manufacturer", "hardware", "tablet",
"hasMMX", "hasSSE", "hasSSE2", "hasSSE3",
"hasSSSE3", "hasSSE4A", "hasSSE4_1", "hasSSE4_2",
"hasEDSP", "hasARMv6", "hasARMv7", "hasNEON", "isWow64",
"profileHDDModel", "profileHDDRevision", "binHDDModel",
"binHDDRevision", "winHDDModel", "winHDDRevision"];
for each (let field in fields) {
let value;
try {
value = sysInfo.getProperty(field);
} catch (e) {
continue;
}
if (field == "memsize") {
// Send RAM size in megabytes. Rounding because sysinfo doesn't
// always provide RAM in multiples of 1024.
value = Math.round(value / 1024 / 1024);
}
ret[field] = value;
}
// gfxInfo fields are not always available, get what we can.
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
let gfxfields = ["adapterDescription", "adapterVendorID", "adapterDeviceID",
"adapterSubsysID", "adapterRAM", "adapterDriver",
"adapterDriverVersion", "adapterDriverDate",
"adapterDescription2", "adapterVendorID2",
"adapterDeviceID2", "adapterSubsysID2", "adapterRAM2",
"adapterDriver2", "adapterDriverVersion2",
"adapterDriverDate2", "isGPU2Active", "D2DEnabled",
"DWriteEnabled", "DWriteVersion"
];
if (gfxInfo) {
for each (let field in gfxfields) {
try {
let value = gfxInfo[field];
// bug 940806: We need to do a strict equality comparison here,
// otherwise a type conversion will occur and boolean false values
// will get filtered out
if (value !== "") {
ret[field] = value;
}
} catch (e) {
continue
}
}
}
#ifndef MOZ_WIDGET_GONK #ifndef MOZ_WIDGET_GONK
let theme = LightweightThemeManager.currentTheme; let theme = LightweightThemeManager.currentTheme;
if (theme) { if (theme) {

View File

@ -168,7 +168,6 @@ function checkPayloadInfo(payload, reason) {
// get rid of the non-deterministic field // get rid of the non-deterministic field
const expected_info = { const expected_info = {
OS: "XPCShell", OS: "XPCShell",
appID: "xpcshell@tests.mozilla.org",
appVersion: "1", appVersion: "1",
appName: "XPCShell", appName: "XPCShell",
appBuildID: "2007010101", appBuildID: "2007010101",
@ -182,7 +181,6 @@ function checkPayloadInfo(payload, reason) {
do_check_eq(payload.info.reason, reason); do_check_eq(payload.info.reason, reason);
do_check_true("appUpdateChannel" in payload.info); do_check_true("appUpdateChannel" in payload.info);
do_check_true("locale" in payload.info);
do_check_true("revision" in payload.info); do_check_true("revision" in payload.info);
if (Services.appinfo.isOfficial) { if (Services.appinfo.isOfficial) {
do_check_true(payload.info.revision.startsWith("http")); do_check_true(payload.info.revision.startsWith("http"));
@ -194,24 +192,6 @@ function checkPayloadInfo(payload, reason) {
do_check_neq(payload.clientID, null); do_check_neq(payload.clientID, null);
do_check_eq(payload.clientID, gDataReportingClientID); do_check_eq(payload.clientID, gDataReportingClientID);
} }
try {
// If we've not got nsIGfxInfoDebug, then this will throw and stop us doing
// this test.
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfoDebug);
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
let isOSX = ("nsILocalFileMac" in Components.interfaces);
if (isWindows || isOSX) {
do_check_true("adapterVendorID" in payload.info);
do_check_true("adapterDeviceID" in payload.info);
if (isWindows) {
do_check_true("adapterSubsysID" in payload.info);
}
}
}
catch (x) {
}
} }
function checkPayload(request, payload, reason, successfulPings) { function checkPayload(request, payload, reason, successfulPings) {
@ -435,13 +415,6 @@ function write_fake_failedprofilelocks_file() {
function run_test() { function run_test() {
do_test_pending(); do_test_pending();
try {
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfoDebug);
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
} catch (x) {
// If we can't test gfxInfo, that's fine, we'll note it later.
}
// Addon manager needs a profile directory // Addon manager needs a profile directory
do_get_profile(); do_get_profile();