Bug 1218842 - Don't submit inactive or invalid GMP plugins in TelemetryEnvironment. r=gfritzsche
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Mon, 02 Nov 2015 06:39:00 +0100
changeset 270836 e402ef99492dc81b1b1f28d04a6baa96de0ec3d2
parent 270835 bcf186f84c36cb4b9d206292625aa3c163c4fcaa
child 270837 9630c50d09660bcb5724847e1d7f3d9c9263dcdf
push id16056
push useralessio.placitelli@gmail.com
push dateTue, 03 Nov 2015 08:49:46 +0000
treeherderfx-team@e402ef99492d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1218842
milestone45.0a1
Bug 1218842 - Don't submit inactive or invalid GMP plugins in TelemetryEnvironment. r=gfritzsche
toolkit/components/telemetry/TelemetryEnvironment.jsm
toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -615,18 +615,18 @@ EnvironmentAddonBuilder.prototype = {
    * running this during addon manager shutdown.
    */
   _getActiveGMPlugins: Task.async(function* () {
     // Request plugins, asynchronously.
     let allPlugins = yield promiseGetAddonsByTypes(["plugin"]);
 
     let activeGMPlugins = {};
     for (let plugin of allPlugins) {
-      // Only get GM Plugin info.
-      if (!plugin.isGMPlugin) {
+      // Only get info for valid and enabled GMPlugins.
+      if (!plugin.isGMPlugin || !plugin.isValid || plugin.disabled) {
         continue;
       }
 
       activeGMPlugins[plugin.id] = {
         version: plugin.version,
         userDisabled: plugin.userDisabled,
         applyBackgroundUpdates: plugin.applyBackgroundUpdates,
       };
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
@@ -553,20 +553,17 @@ function checkTheme(data) {
                  f + " must have the correct type.");
   }
 
   // We check "description" separately, as it can be null.
   Assert.ok(checkNullOrString(data.description));
 }
 
 function checkActiveGMPlugin(data) {
-  // GMP plugin version defaults to null until GMPDownloader runs to update it.
-  if (data.version) {
-    Assert.equal(typeof data.version, "string");
-  }
+  Assert.equal(typeof data.version, "string");
   Assert.equal(typeof data.userDisabled, "boolean");
   Assert.equal(typeof data.applyBackgroundUpdates, "number");
 }
 
 function checkAddonsSection(data) {
   const EXPECTED_FIELDS = [
     "activeAddons", "theme", "activePlugins", "activeGMPlugins", "activeExperiment",
     "persona",