Bug 1166646 - WINDOW_ENABLED telemetry key is falsy, thus not working. Check for its type properly. r=Standard8, a=lizzard
authorMike de Boer <mdeboer@mozilla.com>
Tue, 26 May 2015 15:35:59 +0200
changeset 266150 a2f619521d74
parent 266149 9d21268e218c
child 266151 cf279fc867d5
child 266156 524d0360d4ea
child 266158 86659b66da94
push id4766
push userryanvm@gmail.com
push date2015-06-01 16:39 +0000
treeherdermozilla-beta@a2f619521d74 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, lizzard
bugs1166646
milestone39.0
Bug 1166646 - WINDOW_ENABLED telemetry key is falsy, thus not working. Check for its type properly. r=Standard8, a=lizzard
browser/components/loop/content/shared/js/otSdkDriver.js
browser/components/loop/test/shared/otSdkDriver_test.js
--- a/browser/components/loop/content/shared/js/otSdkDriver.js
+++ b/browser/components/loop/content/shared/js/otSdkDriver.js
@@ -727,17 +727,17 @@ loop.OTSdkDriver = (function() {
      */
     _noteSharingState: function(type, enabled) {
       if (!this.mozLoop) {
         return;
       }
 
       var bucket = this.mozLoop.SHARING_STATE_CHANGE[type.toUpperCase() + "_" +
         (enabled ? "ENABLED" : "DISABLED")];
-      if (!bucket) {
+      if (typeof bucket === "undefined") {
         console.error("No sharing state bucket found for '" + type + "'");
         return;
       }
 
       this.mozLoop.telemetryAddValue("LOOP_SHARING_STATE_CHANGE_1", bucket);
     }
   };
 
--- a/browser/components/loop/test/shared/otSdkDriver_test.js
+++ b/browser/components/loop/test/shared/otSdkDriver_test.js
@@ -62,26 +62,26 @@ describe("loop.OTSdkDriver", function ()
       ExceptionCodes: {
         UNABLE_TO_PUBLISH: 1500
       }
     };
 
     mozLoop = {
       telemetryAddValue: sinon.stub(),
       TWO_WAY_MEDIA_CONN_LENGTH: {
-        SHORTER_THAN_10S: "SHORTER_THAN_10S",
-        BETWEEN_10S_AND_30S: "BETWEEN_10S_AND_30S",
-        BETWEEN_30S_AND_5M: "BETWEEN_30S_AND_5M",
-        MORE_THAN_5M: "MORE_THAN_5M"
+        SHORTER_THAN_10S: 0,
+        BETWEEN_10S_AND_30S: 1,
+        BETWEEN_30S_AND_5M: 2,
+        MORE_THAN_5M: 3
       },
       SHARING_STATE_CHANGE: {
-        WINDOW_ENABLED: "WINDOW_ENABLED",
-        WINDOW_DISABLED: "WINDOW_DISABLED",
-        BROWSER_ENABLED: "BROWSER_ENABLED",
-        BROWSER_DISABLED: "BROWSER_DISABLED"
+        WINDOW_ENABLED: 0,
+        WINDOW_DISABLED: 1,
+        BROWSER_ENABLED: 2,
+        BROWSER_DISABLED: 3
       }
     };
 
     driver = new loop.OTSdkDriver({
       dispatcher: dispatcher,
       sdk: sdk,
       mozLoop: mozLoop,
       isDesktop: true