diff --git a/lib/testpilot/experiment.js b/lib/testpilot/experiment.js index 329bd69..1b4e98f 100644 --- a/lib/testpilot/experiment.js +++ b/lib/testpilot/experiment.js @@ -82,21 +82,14 @@ function experimentPing(event) { } function Experiment() { - Events.on(EVENT_SEND_METRIC, experimentPing); + // If the user has @testpilot-addon, it already bound + // experimentPing to testpilot::send-metric, + // so we don't need to bind this one + AddonManager.getAddonByID('@testpilot-addon', addon => { + if (!addon) { + Events.on(EVENT_SEND_METRIC, experimentPing); + } + }); } -Experiment.prototype = { - constructor: function() { - Events.on(EVENT_SEND_METRIC, experimentPing); - }, - - ping: function(event) { - experimentPing(event); - }, - - teardown: function() { - Events.off(EVENT_SEND_METRIC, experimentPing); - } -}; - module.exports = Experiment; diff --git a/testpilot-metrics.js b/testpilot-metrics.js index 2aad4bd..2914884 100644 --- a/testpilot-metrics.js +++ b/testpilot-metrics.js @@ -173,7 +173,6 @@ Metrics.prototype = { }; try { - console.log("notifying observerser of testpilot::send-metric; subject: ", subject, " stringified: ", stringified); Services.obs.notifyObservers(subject, 'testpilot::send-metric', stringified); this._log(`Sent client message via nsIObserverService: ${stringified}`); } catch (ex) {