Bug 1256290 - isGPUActive for the second graphics adapter doesn't work correctly, and this also means we should tighten up getGfxField a little bit r?gfritzsche
MozReview-Commit-ID: 3384RChTh2A
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -260,17 +260,17 @@ function getSysinfoProperty(aPropertyNam
* @return The property value, if available, or aDefault.
*/
function getGfxField(aPropertyName, aDefault) {
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
try {
// Accessing the field may throw if |aPropertyName| does not exist.
let gfxProp = gfxInfo[aPropertyName];
- if (gfxProp !== "") {
+ if (gfxProp !== undefined && gfxProp !== "") {
return gfxProp;
}
} catch (e) {}
return aDefault;
}
/**
@@ -1311,17 +1311,17 @@ EnvironmentCache.prototype = {
if (!hasGPU2) {
this._log.trace("_getGFXData - Only one display adapter detected.");
return gfxData;
}
this._log.trace("_getGFXData - Two display adapters detected.");
gfxData.adapters.push(getGfxAdapter("2"));
- gfxData.adapters[1].GPUActive = getGfxField("isGPU2Active ", null);
+ gfxData.adapters[1].GPUActive = getGfxField("isGPU2Active", null);
return gfxData;
},
/**
* Get the system data in object form.
* @return Object containing the system data.
*/