Bug 1140558 - Part 4 - Fix TelemetryEnvironment returning NaN for GFX RAM on error. r=gfritzsche
☠☠ backed out by b4ad5033ab88 ☠ ☠
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Fri, 27 Mar 2015 21:01:20 +0100
changeset 265050 d3512bb40d24e6d7f3671bb6c1aea13a7b9bd8a7
parent 265049 a54f84a3d26537d9ed5ed0472a4abd480b2c8b79
child 265051 756c80951bbbc943d01815e3236e7946f1da39e1
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1140558
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1140558 - Part 4 - Fix TelemetryEnvironment returning NaN for GFX RAM on error. r=gfritzsche
toolkit/components/telemetry/TelemetryEnvironment.jsm
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -234,19 +234,21 @@ function getGfxField(aPropertyName, aDef
 
 /**
  * Get the information about a graphic adapter.
  *
  * @param aSuffix A suffix to add to the properties names.
  * @return An object containing the adapter properties.
  */
 function getGfxAdapter(aSuffix = "") {
-  let memoryMB = getGfxField("adapterRAM" + aSuffix, null);
-  if (memoryMB) {
-    memoryMB = parseInt(memoryMB, 10);
+  // Note that gfxInfo, and so getGfxField, might return "Unknown" for the RAM on failures,
+  // not null.
+  let memoryMB = parseInt(getGfxField("adapterRAM" + aSuffix, null), 10);
+  if (Number.isNaN(memoryMB)) {
+    memoryMB = null;
   }
 
   return {
     description: getGfxField("adapterDescription" + aSuffix, null),
     vendorID: getGfxField("adapterVendorID" + aSuffix, null),
     deviceID: getGfxField("adapterDeviceID" + aSuffix, null),
     subsysID: getGfxField("adapterSubsysID" + aSuffix, null),
     RAM: memoryMB,