Bug 1177461 - Check that the Adobe EME plugin voucher is present before advertising that Adobe EME will work to JS. r=edwin,a=ritu
authorChris Pearce <cpearce@mozilla.com>
Fri, 26 Jun 2015 08:06:21 -0700
changeset 275244 b1b9503edc7c5f3b8e5d9723f94e0d9426b84a5e
parent 275243 c9af6025b8bc7f76d135dd82ac3ff065d59e7e05
child 275245 8c6508de1b3a08307d4bca7eecefad309ed4d897
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)
reviewersedwin, ritu
bugs1177461
milestone40.0
Bug 1177461 - Check that the Adobe EME plugin voucher is present before advertising that Adobe EME will work to JS. r=edwin,a=ritu
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