Backed out changesets cf2860ddc77c and 502444490789 (bug 1156566) for test_gmpProvider.js failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 20 May 2015 16:42:18 -0400
changeset 274668 d00b220688b3eab30236cfe9af8b536fe34d235b
parent 274667 7467f27001fde3c4db7dd0a17a4d50a90374807d
child 274669 a7f3541d133bf220ecbcfda808ec3af6c1394ee4
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)
bugs1156566
milestone40.0a2
backs outcf2860ddc77c87e9a6e93644a20e9b5e5b870ab5
50244449078998e97ade40ad2140a4817c71b9ea
Backed out changesets cf2860ddc77c and 502444490789 (bug 1156566) for test_gmpProvider.js failures.
toolkit/components/telemetry/Histograms.json
toolkit/modules/GMPUtils.jsm
toolkit/mozapps/extensions/internal/GMPProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7514,30 +7514,16 @@
     "kind": "count"
   },
   "VIDEO_MSE_UNLOAD_STATE": {
     "expires_in_version": "45",
     "kind": "enumerated",
     "n_values": 5,
     "description": "MSE video state when unloading. ended = 0, paused = 1, stalled = 2, seeking = 3, other = 4"
   },
-  "VIDEO_ADOBE_GMP_DISAPPEARED": {
-    "alert_emails": ["cpearce@mozilla.com"],
-    "expires_in_version": "42",
-    "kind": "flag",
-    "description": "Whether or not the Adobe EME GMP was expected to be resident on disk but mysteriously isn't.",
-    "releaseChannelCollection": "opt-out"
-  },
-  "VIDEO_OPENH264_GMP_DISAPPEARED": {
-    "alert_emails": ["cpearce@mozilla.com", "rjesup@mozilla.com"],
-    "expires_in_version": "42",
-    "kind": "flag",
-    "description": "Whether or not the OpenH264 GMP was expected to be resident on disk but mysteriously isn't.",
-    "releaseChannelCollection": "opt-out"
-  },
   "FX_SANITIZE_TOTAL": {
     "alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
     "expires_in_version": "50",
     "kind": "exponential",
     "high": "30000",
     "n_buckets": 20,
     "extended_statistics_ok": true,
     "description": "Sanitize: Total time it takes to sanitize (ms)"
--- a/toolkit/modules/GMPUtils.jsm
+++ b/toolkit/modules/GMPUtils.jsm
@@ -84,18 +84,18 @@ this.GMPPrefs = {
   KEY_UPDATE_LAST_CHECK:        "media.gmp-manager.lastCheck",
   KEY_SECONDS_BETWEEN_CHECKS:   "media.gmp-manager.secondsBetweenChecks",
   KEY_APP_DISTRIBUTION:         "distribution.id",
   KEY_APP_DISTRIBUTION_VERSION: "distribution.version",
   KEY_BUILDID:                  "media.gmp-manager.buildID",
   KEY_CERTS_BRANCH:             "media.gmp-manager.certs.",
   KEY_PROVIDER_ENABLED:         "media.gmp-provider.enabled",
   KEY_LOG_BASE:                 "media.gmp.log.",
-  KEY_LOGGING_LEVEL:            "media.gmp.log.level",
-  KEY_LOGGING_DUMP:             "media.gmp.log.dump",
+  KEY_LOGGING_LEVEL:            this.KEY_LOG_BASE + "level",
+  KEY_LOGGING_DUMP:             this.KEY_LOG_BASE + "dump",
 
   /**
    * Obtains the specified preference in relation to the specified plugin.
    * @param aKey The preference key value to use.
    * @param aDefaultValue The default value if no preference exists.
    * @param aPlugin The plugin to scope the preference to.
    * @return The obtained preference value, or the defaultValue if none exists.
    */
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -43,42 +43,38 @@ const GMP_PLUGINS = [
     id:              OPEN_H264_ID,
     name:            "openH264_name",
     description:     "openH264_description2",
     // The following licenseURL is part of an awful hack to include the OpenH264
     // license without having bug 624602 fixed yet, and intentionally ignores
     // localisation.
     licenseURL:      "chrome://mozapps/content/extensions/OpenH264-license.txt",
     homepageURL:     "http://www.openh264.org/",
-    optionsURL:      "chrome://mozapps/content/extensions/gmpPrefs.xul",
-    missingKey:      "VIDEO_OPENH264_GMP_DISAPPEARED",
+    optionsURL:      "chrome://mozapps/content/extensions/gmpPrefs.xul"
   },
   {
     id:              EME_ADOBE_ID,
     name:            "eme-adobe_name",
     description:     "eme-adobe_description",
     // The following learnMoreURL is another hack to be able to support a SUMO page for this
     // feature.
     get learnMoreURL() {
       return Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
     },
     licenseURL:      "http://help.adobe.com/en_US/primetime/drm/HTML5_CDM_EULA/index.html",
     homepageURL:     "http://help.adobe.com/en_US/primetime/drm/HTML5_CDM",
     optionsURL:      "chrome://mozapps/content/extensions/gmpPrefs.xul",
-    isEME:           true,
-    missingKey:      "VIDEO_ADOBE_GMP_DISAPPEARED",
+    isEME:           true
   }];
 
 XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
   () => Services.strings.createBundle("chrome://global/locale/plugins.properties"));
 XPCOMUtils.defineLazyGetter(this, "gmpService",
   () => Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(Ci.mozIGeckoMediaPluginChromeService));
 
-XPCOMUtils.defineLazyGetter(this, "telemetryService", () => Services.telemetry);
-
 let messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
                        .getService(Ci.nsIMessageListenerManager);
 
 let gLogger;
 let gLogAppenderDump = null;
 
 function configureLogging() {
   if (!gLogger) {
@@ -139,20 +135,16 @@ GMPWrapper.prototype = {
       this._gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
                                    this._plugin.id,
                                    GMPPrefs.get(GMPPrefs.KEY_PLUGIN_VERSION,
                                                 null, this._plugin.id));
     }
     return this._gmpPath;
   },
 
-  get missingKey() {
-    return this._plugin.missingKey;
-  },
-
   get id() { return this._plugin.id; },
   get type() { return "plugin"; },
   get isGMPlugin() { return true; },
   get name() { return this._plugin.name; },
   get creator() { return null; },
   get homepageURL() { return this._plugin.homepageURL; },
 
   get description() { return this._plugin.description; },
@@ -450,53 +442,16 @@ GMPWrapper.prototype = {
                        this.onPrefVersionChanged, this);
     if (this._plugin.isEME) {
       Preferences.ignore(GMPPrefs.KEY_EME_ENABLED,
                          this.onPrefEMEGlobalEnabledChanged, this);
       messageManager.removeMessageListener("EMEVideo:ContentMediaKeysRequest", this);
     }
     return this._updateTask;
   },
-
-  _arePluginFilesOnDisk: function () {
-    let fileExists = function(aGmpPath, aFileName) {
-      let f = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
-      let path = OS.Path.join(aGmpPath, aFileName);
-      f.initWithPath(path);
-      return f.exists();
-    };
-
-    // Determine the name of the GMP dynamic library; it differs on every
-    // platform. Note: we can't use Services.appInfo.OS here, as that's
-    // "XPCShell" in our tests.
-    let isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
-    let isOSX = ("nsILocalFileMac" in Ci);
-    let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
-
-    let libName = "";
-    let id = this._plugin.id;
-    if (isWindows) {
-      libName = id.substring(4) + ".dll";
-    } else if (isOSX) {
-      libName = "lib" + id.substring(4) + ".dylib";
-    } else if (isLinux) {
-      libName = id.substring(4) + ".so";
-    } else {
-      this._info.error("_arePluginFilesOnDisk - unsupported platform.");
-      return false;
-    }
-
-    return fileExists(this.gmpPath, libName) &&
-           fileExists(this.gmpPath, id.substring(4) + ".info");
-  },
-
-  validate: function() {
-    return !this.isInstalled ||
-           this._arePluginFilesOnDisk();
-  },
 };
 
 let GMPProvider = {
   get name() { return "GMPProvider"; },
 
   _plugins: null,
 
   startup: function() {
@@ -512,23 +467,16 @@ let GMPProvider = {
     for (let [id, plugin] of this._plugins) {
       let wrapper = plugin.wrapper;
       let gmpPath = wrapper.gmpPath;
       let isEnabled = wrapper.isActive;
       this._log.trace("startup - enabled=" + isEnabled + ", gmpPath=" +
                       gmpPath);
 
       if (gmpPath && isEnabled) {
-        if (!wrapper.validate()) {
-          this._log.info("startup - gmp " + plugin.id +
-                         " missing lib and/or info files, uninstalling");
-          telemetryService.getHistogramById(wrapper.missingKey).add(true);
-          wrapper.uninstallPlugin();
-          continue;
-        }
         this._log.info("startup - adding gmp directory " + gmpPath);
         try {
           gmpService.addPluginDirectory(gmpPath);
         } catch (e if e.name == 'NS_ERROR_NOT_AVAILABLE') {
           this._log.warn("startup - adding gmp directory failed with " +
                          e.name + " - sandboxing not available?", e);
         }
       }
@@ -634,17 +582,16 @@ let GMPProvider = {
       let plugin = {
         id: aPlugin.id,
         name: pluginsBundle.GetStringFromName(aPlugin.name),
         description: pluginsBundle.GetStringFromName(aPlugin.description),
         homepageURL: aPlugin.homepageURL,
         optionsURL: aPlugin.optionsURL,
         wrapper: null,
         isEME: aPlugin.isEME,
-        missingKey: aPlugin.missingKey,
       };
       plugin.fullDescription = this.generateFullDescription(aPlugin);
       plugin.wrapper = new GMPWrapper(plugin);
       this._plugins.set(plugin.id, plugin);
     }
   },
 
   ensureProperCDMInstallState: function() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
@@ -4,30 +4,26 @@
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 let GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
   () => Services.strings.createBundle("chrome://global/locale/plugins.properties"));
 
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
-                                  "resource://gre/modules/FileUtils.jsm");
-
 let gMockAddons = new Map();
 let gMockEmeAddons = new Map();
 
 for (let plugin of GMPScope.GMP_PLUGINS) {
   let mockAddon = Object.freeze({
       id: plugin.id,
       isValid: true,
       isInstalled: false,
       nameId: plugin.name,
       descriptionId: plugin.description,
-      missingKey: plugin.missingKey,
   });
   gMockAddons.set(mockAddon.id, mockAddon);
   if (mockAddon.id.indexOf("gmp-eme-") == 0) {
     gMockEmeAddons.set(mockAddon.id, mockAddon);
   }
 }
 
 let gInstalledAddonId = "";
@@ -215,111 +211,40 @@ add_task(function* test_autoUpdatePrefPe
     Assert.equal(addon.applyBackgroundUpdates, AddonManager.AUTOUPDATE_ENABLE);
     Assert.ok(gPrefs.getBoolPref(autoupdateKey));
 
     addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
     Assert.ok(!gPrefs.prefHasUserValue(autoupdateKey));
   }
 });
 
-function createMockPluginFilesIfNeeded(aFile, aPluginId) {
-  function createFile(aFileName) {
-    let f = aFile.clone();
-    f.append(aFileName);
-    if (!f.exists()) {
-      f.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-    }
-  };
-
-  // Note: we can't use Services.appInfo.OS, as that's "XPCShell" in our tests.
-  let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
-  let isOSX = ("nsILocalFileMac" in Components.interfaces);
-  let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Components.classes);
-
-  let libName = "";
-  if (isWindows) {
-    libName = aPluginId.substring(4) + ".dll";
-  } else if (isOSX) {
-    libName = "lib" + aPluginId.substring(4) + ".dylib";
-  } else if (isLinux) {
-    libName = aPluginId.substring(4) + ".so";
-  } else {
-    // FAIL!
-    return;
-  }
-  createFile(libName);
-  createFile(aPluginId.substring(4) + ".info");
-}
-
 add_task(function* test_pluginRegistration() {
   const TEST_VERSION = "1.2.3.4";
 
-  let profD = do_get_profile();
   for (let addon of gMockAddons.values()) {
-    let file = profD.clone();
+    let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
     file.append(addon.id);
     file.append(TEST_VERSION);
 
     let addedPaths = [];
     let removedPaths = [];
     let clearPaths = () => { addedPaths = []; removedPaths = []; }
 
     let MockGMPService = {
-      addPluginDirectory: path => {
-        if (!addedPaths.includes(path)) {
-          addedPaths.push(path);
-        }
-      },
-      removePluginDirectory: path => {
-        if (!removedPaths.includes(path)) {
-          removedPaths.push(path);
-        }
-      },
-      removeAndDeletePluginDirectory: path => {
-        if (!removedPaths.includes(path)) {
-          removedPaths.push(path);
-        }
-      },
-    };
-
-    let reportedKeys = [];
-
-    let MockTelemetry = {
-      getHistogramById: key => {
-        return {
-          add: value => {
-            reportedKeys.push(key);
-          }
-        }
-      }
+      addPluginDirectory: path => addedPaths.push(path),
+      removePluginDirectory: path => removedPaths.push(path),
+      removeAndDeletePluginDirectory: path => removedPaths.push(path),
     };
 
     GMPScope.gmpService = MockGMPService;
-    GMPScope.telemetryService = MockTelemetry;
     gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), true);
 
-    // Test that plugin registration fails if the plugin dynamic library and
-    // info files are not present.
+    // Check that the plugin gets registered after startup.
     gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
-                       TEST_VERSION);
-    clearPaths();
-    yield promiseRestartManager();
-    Assert.equal(addedPaths.indexOf(file.path), -1);
-    Assert.deepEqual(removedPaths, [file.path]);
-
-    // Test that the GMPProvider tried to report via telemetry that the
-    // addon's lib file is missing.
-    Assert.deepEqual(reportedKeys, [addon.missingKey]);
-
-    // Create dummy GMP library/info files, and test that plugin registration
-    // succeeds during startup, now that we've added GMP info/lib files.
-    createMockPluginFilesIfNeeded(file, addon.id);
-
-    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
-                       TEST_VERSION);
+                      TEST_VERSION);
     clearPaths();
     yield promiseRestartManager();
     Assert.notEqual(addedPaths.indexOf(file.path), -1);
     Assert.deepEqual(removedPaths, []);
 
     // Check that clearing the version doesn't trigger registration.
     clearPaths();
     gPrefs.clearUserPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id));
@@ -329,30 +254,30 @@ add_task(function* test_pluginRegistrati
     // Restarting with no version set should not trigger registration.
     clearPaths();
     yield promiseRestartManager();
     Assert.equal(addedPaths.indexOf(file.path), -1);
     Assert.equal(removedPaths.indexOf(file.path), -1);
 
     // Changing the pref mid-session should cause unregistration and registration.
     gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
-                       TEST_VERSION);
+                      TEST_VERSION);
     clearPaths();
     const TEST_VERSION_2 = "5.6.7.8";
     let file2 = Services.dirsvc.get("ProfD", Ci.nsIFile);
     file2.append(addon.id);
     file2.append(TEST_VERSION_2);
     gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
                       TEST_VERSION_2);
     Assert.deepEqual(addedPaths, [file2.path]);
     Assert.deepEqual(removedPaths, [file.path]);
 
     // Disabling the plugin should cause unregistration.
     gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
-                       TEST_VERSION);
+                      TEST_VERSION);
     clearPaths();
     gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), false);
     Assert.deepEqual(addedPaths, []);
     Assert.deepEqual(removedPaths, [file.path]);
 
     // Restarting with the plugin disabled should not cause registration.
     clearPaths();
     yield promiseRestartManager();