Bug 1177461 - Check that the Adobe EME plugin voucher is present before advertising that Adobe EME will work to JS. r=edwin
authorChris Pearce <cpearce@mozilla.com>
Fri, 26 Jun 2015 08:06:21 -0700
changeset 281194 baf797bf2912a1c78aabbf963904bba008399052
parent 281193 5fb9272062b9c3819f0d167e93fe20bca0e20b1c
child 281195 ba5f47ced2590d2697bca58596a36addc5d84cd7
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1177461
milestone41.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 1177461 - Check that the Adobe EME plugin voucher is present before advertising that Adobe EME will work to JS. r=edwin
dom/media/eme/MediaKeySystemAccess.cpp
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -92,17 +92,18 @@ HaveGMPFor(mozIGeckoMediaPluginService* 
                                              &hasPlugin))) {
     return false;
   }
   return hasPlugin;
 }
 
 #ifdef XP_WIN
 static bool
-AdobePluginDLLExists(const nsACString& aVersionStr)
+AdobePluginFileExists(const nsACString& aVersionStr,
+                      const nsAString& aFilename)
 {
   nsCOMPtr<nsIFile> path;
   nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(path));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   rv = path->Append(NS_LITERAL_STRING("gmp-eme-adobe"));
@@ -110,24 +111,36 @@ AdobePluginDLLExists(const nsACString& a
     return false;
   }
 
   rv = path->AppendNative(aVersionStr);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
-  rv = path->Append(NS_LITERAL_STRING("eme-adobe.dll"));
+  rv = path->Append(aFilename);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   bool exists = false;
   return NS_SUCCEEDED(path->Exists(&exists)) && exists;
 }
+
+static bool
+AdobePluginDLLExists(const nsACString& aVersionStr)
+{
+  return AdobePluginFileExists(aVersionStr, NS_LITERAL_STRING("eme-adobe.dll"));
+}
+
+static bool
+AdobePluginVoucherExists(const nsACString& aVersionStr)
+{
+  return AdobePluginFileExists(aVersionStr, NS_LITERAL_STRING("eme-adobe.voucher"));
+}
 #endif
 
 static MediaKeySystemStatus
 EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
                     const nsAString& aKeySystem,
                     int32_t aMinCdmVersion,
                     bool aCheckForV6=false)
 {
@@ -162,18 +175,19 @@ EnsureMinCDMVersion(mozIGeckoMediaPlugin
     return MediaKeySystemStatus::Cdm_insufficient_version;
   }
 
 #ifdef XP_WIN
   if (aKeySystem.EqualsLiteral("com.adobe.access") ||
       aKeySystem.EqualsLiteral("com.adobe.primetime")) {
     // Verify that anti-virus hasn't "helpfully" deleted the Adobe GMP DLL,
     // as we suspect may happen (Bug 1160382).
-    if (!AdobePluginDLLExists(versionStr)) {
-      NS_WARNING("Adobe EME plugin disappeared from disk!");
+    if (!AdobePluginDLLExists(versionStr) ||
+        !AdobePluginVoucherExists(versionStr)) {
+      NS_WARNING("Adobe EME plugin or voucher disappeared from disk!");
       // Reset the prefs that Firefox's GMP downloader sets, so that
       // Firefox will try to download the plugin next time the updater runs.
       Preferences::ClearUser("media.gmp-eme-adobe.lastUpdate");
       Preferences::ClearUser("media.gmp-eme-adobe.version");
       return MediaKeySystemStatus::Cdm_not_installed;
     }
   }
 #endif