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 draft
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 14 Mar 2016 09:30:29 -0400
changeset 339961 01f0a56909784cc04415714b373fadfdb68eadf8
parent 338591 af7c0cb0798f5425d5d344cbaf0ac0ecb1a72a86
child 339962 f105da431b2d9fc001a4d143350ccf00c22bbde5
child 340549 fae01778b3afbe6ca9dfcf774cead01eeac50445
push id12850
push userbsmedberg@mozilla.com
push dateMon, 14 Mar 2016 15:41:58 +0000
reviewersgfritzsche
bugs1256290
milestone48.0a1
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
toolkit/components/telemetry/TelemetryEnvironment.jsm
--- 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.
    */