Bug 1160361 - Skip Telemetry calls for non-Firefox. r=bgrins
authorJ. Ryan Stinnett <jryans@gmail.com>
Wed, 06 May 2015 12:34:28 -0500
changeset 274011 5cdf7ebf5d6fcf8cbb5daa339ccf5c3a82a98bd1
parent 274010 a737f0563c1fb8577a39247a6518443f940482f6
child 274012 ba4ae6b6dcfcbe87367047b586cc49ebd2a72121
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1160361
milestone40.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 1160361 - Skip Telemetry calls for non-Firefox. r=bgrins
toolkit/devtools/gcli/commands/paintflashing.js
--- a/toolkit/devtools/gcli/commands/paintflashing.js
+++ b/toolkit/devtools/gcli/commands/paintflashing.js
@@ -2,18 +2,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { Cc, Ci, Cu } = require("chrome");
 const TargetFactory = require("resource://gre/modules/devtools/Loader.jsm").devtools.TargetFactory;
 
-const Telemetry = require("devtools/shared/telemetry");
-const telemetry = new Telemetry();
+let telemetry;
+try {
+  const Telemetry = require("devtools/shared/telemetry");
+  telemetry = new Telemetry();
+} catch(e) {
+  // DevTools Telemetry module only available in Firefox
+}
 
 const EventEmitter = require("devtools/toolkit/event-emitter");
 const eventEmitter = new EventEmitter();
 
 const gcli = require("gcli/index");
 const l10n = require("gcli/l10n");
 
 /**
@@ -30,16 +35,19 @@ function onPaintFlashingChanged(target, 
   eventEmitter.emit("changed", { target: target });
   function fireChange() {
     eventEmitter.emit("changed", { target: target });
   }
 
   target.off("navigate", fireChange);
   target.once("navigate", fireChange);
 
+  if (!telemetry) {
+    return;
+  }
   if (value) {
     telemetry.toolOpened("paintflashing");
   } else {
     telemetry.toolClosed("paintflashing");
   }
 }
 
 /**