Backed out changeset c2f648fbcbf1 (bug 1533861) for test_TelemetryEnvironment.js failures

This commit is contained in:
Bogdan Tara 2019-05-03 06:22:25 +03:00
parent 386d23bfe7
commit f7ff4f47cc
4 changed files with 6 additions and 38 deletions

View File

@ -1717,17 +1717,14 @@ EnvironmentCache.prototype = {
profile: { // hdd where the profile folder is located
model: getSysinfoProperty("profileHDDModel", null),
revision: getSysinfoProperty("profileHDDRevision", null),
type: getSysinfoProperty("profileHDDType", null),
},
binary: { // hdd where the application binary is located
model: getSysinfoProperty("binHDDModel", null),
revision: getSysinfoProperty("binHDDRevision", null),
type: getSysinfoProperty("binHDDType", null),
},
system: { // hdd where the system files are located
model: getSysinfoProperty("winHDDModel", null),
revision: getSysinfoProperty("winHDDRevision", null),
type: getSysinfoProperty("winHDDType", null),
},
};
},

View File

@ -141,17 +141,14 @@ Structure:
profile: { // hdd where the profile folder is located
model: <string>, // windows only or null on failure
revision: <string>, // windows only or null on failure
type: <string>, // "SSD" or "HDD" windows only or null on failure
},
binary: { // hdd where the application binary is located
model: <string>, // windows only or null on failure
revision: <string>, // windows only or null on failure
type: <string>, // "SSD" or "HDD" windows only or null on failure
},
system: { // hdd where the system files are located
model: <string>, // windows only or null on failure
revision: <string>, // windows only or null on failure
type: <string>, // "SSD" or "HDD" windows only or null on failure
},
},
gfx: {

View File

@ -606,7 +606,6 @@ function checkSystemSection(data) {
for (let disk of EXPECTED_HDD_FIELDS) {
Assert.ok(check(data.system.hdd[disk].model));
Assert.ok(check(data.system.hdd[disk].revision));
Assert.ok(check(data.system.hdd[disk].type));
}
let gfxData = data.system.gfx;

View File

@ -101,10 +101,9 @@ static void SimpleParseKeyValuePairs(
#if defined(XP_WIN)
namespace {
nsresult GetHDDInfo(const char* aSpecialDirName, nsAutoCString& aModel,
nsAutoCString& aRevision, nsAutoCString& aType) {
nsAutoCString& aRevision) {
aModel.Truncate();
aRevision.Truncate();
aType.Truncate();
nsCOMPtr<nsIFile> profDir;
nsresult rv =
@ -150,15 +149,6 @@ nsresult GetHDDInfo(const char* aSpecialDirName, nsAutoCString& aModel,
free(deviceOutput);
return NS_ERROR_FAILURE;
}
queryParameters.PropertyId = StorageDeviceTrimProperty;
bytesRead = 0;
DEVICE_TRIM_DESCRIPTOR trimDescriptor = {sizeof(DEVICE_TRIM_DESCRIPTOR)};
if (!::DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY, &queryParameters,
sizeof(queryParameters), &trimDescriptor,
sizeof(trimDescriptor), &bytesRead, nullptr)) {
return NS_ERROR_FAILURE;
}
// Some HDDs are including product ID info in the vendor field. Since PNP
// IDs include vendor info and product ID concatenated together, we'll do
// that here and interpret the result as a unique ID for the HDD model.
@ -176,11 +166,6 @@ nsresult GetHDDInfo(const char* aSpecialDirName, nsAutoCString& aModel,
deviceOutput->ProductRevisionOffset;
aRevision.CompressWhitespace();
}
if (trimDescriptor.TrimEnabled) {
aType = "SSD";
} else {
aType = "HDD";
}
free(deviceOutput);
return NS_OK;
}
@ -797,25 +782,20 @@ nsresult nsSystemInfo::Init() {
return rv;
}
}
nsAutoCString hddModel, hddRevision, hddType;
if (NS_SUCCEEDED(GetHDDInfo(NS_GRE_DIR, hddModel, hddRevision, hddType))) {
nsAutoCString hddModel, hddRevision;
if (NS_SUCCEEDED(GetHDDInfo(NS_GRE_DIR, hddModel, hddRevision))) {
rv = SetPropertyAsACString(NS_LITERAL_STRING("binHDDModel"), hddModel);
NS_ENSURE_SUCCESS(rv, rv);
rv =
SetPropertyAsACString(NS_LITERAL_STRING("binHDDRevision"), hddRevision);
NS_ENSURE_SUCCESS(rv, rv);
rv = SetPropertyAsACString(NS_LITERAL_STRING("binHDDType"), hddType);
NS_ENSURE_SUCCESS(rv, rv);
}
if (NS_SUCCEEDED(
GetHDDInfo(NS_WIN_WINDOWS_DIR, hddModel, hddRevision, hddType))) {
if (NS_SUCCEEDED(GetHDDInfo(NS_WIN_WINDOWS_DIR, hddModel, hddRevision))) {
rv = SetPropertyAsACString(NS_LITERAL_STRING("winHDDModel"), hddModel);
NS_ENSURE_SUCCESS(rv, rv);
rv =
SetPropertyAsACString(NS_LITERAL_STRING("winHDDRevision"), hddRevision);
NS_ENSURE_SUCCESS(rv, rv);
rv = SetPropertyAsACString(NS_LITERAL_STRING("winHDDType"), hddType);
NS_ENSURE_SUCCESS(rv, rv);
}
nsAutoString countryCode;
@ -1082,9 +1062,8 @@ nsSystemInfo::Observe(nsISupports* aSubject, const char* aTopic,
}
nsresult nsSystemInfo::GetProfileHDDInfo() {
nsAutoCString hddModel, hddRevision, hddType;
nsresult rv =
GetHDDInfo(NS_APP_USER_PROFILE_50_DIR, hddModel, hddRevision, hddType);
nsAutoCString hddModel, hddRevision;
nsresult rv = GetHDDInfo(NS_APP_USER_PROFILE_50_DIR, hddModel, hddRevision);
if (NS_FAILED(rv)) {
return rv;
}
@ -1094,10 +1073,6 @@ nsresult nsSystemInfo::GetProfileHDDInfo() {
}
rv = SetPropertyAsACString(NS_LITERAL_STRING("profileHDDRevision"),
hddRevision);
if (NS_FAILED(rv)) {
return rv;
}
rv = SetPropertyAsACString(NS_LITERAL_STRING("profileHDDType"), hddType);
return rv;
}