Bug 1314452 - Remove IsGMPPresentOnDisk checks from Gecko. r?gerald
These are done in the GMPProvider, so it's unnecessary to do them again inside
Gecko. Plus, they cause main thread synchronous IPC in multi-process Firefox.
MozReview-Commit-ID: EcG38i3b2Oh
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -45,17 +45,16 @@
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DOMStorageIPC.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/ExternalHelperAppParent.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/GeolocationBinding.h"
-#include "mozilla/dom/MediaKeySystemAccess.h"
#include "mozilla/dom/Notification.h"
#include "mozilla/dom/PContentBridgeParent.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
#include "mozilla/dom/PMemoryReportRequestParent.h"
#include "mozilla/dom/ServiceWorkerRegistrar.h"
#include "mozilla/dom/bluetooth/PBluetoothParent.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
@@ -961,28 +960,16 @@ static nsIDocShell* GetOpenerDocShellHel
bool
ContentParent::RecvCreateGMPService()
{
return PGMPService::Open(this);
}
bool
-ContentParent::RecvIsGMPPresentOnDisk(const nsString& aKeySystem,
- const nsCString& aVersion,
- bool* aIsPresent,
- nsCString* aMessage)
-{
- *aIsPresent = MediaKeySystemAccess::IsGMPPresentOnDisk(aKeySystem,
- aVersion,
- *aMessage);
- return true;
-}
-
-bool
ContentParent::RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID)
{
*aRv = NS_OK;
return mozilla::plugins::SetupBridge(aPluginId, this, false, aRv, aRunID);
}
bool
ContentParent::RecvUngrabPointer(const uint32_t& aTime)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -243,21 +243,16 @@ public:
bool* aIsForApp,
bool* aIsForBrowser,
TabId* aTabId) override;
virtual bool RecvBridgeToChildProcess(const ContentParentId& aCpId) override;
virtual bool RecvCreateGMPService() override;
- virtual bool RecvIsGMPPresentOnDisk(const nsString& aKeySystem,
- const nsCString& aVersion,
- bool* aIsPresent,
- nsCString* aMessage) override;
-
virtual bool RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv,
uint32_t* aRunID) override;
virtual bool RecvConnectPluginBridge(const uint32_t& aPluginId,
nsresult* aRv) override;
virtual bool RecvGetBlocklistState(const uint32_t& aPluginId,
uint32_t* aIsBlocklisted) override;
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -705,18 +705,16 @@ parent:
sync CreateChildProcess(IPCTabContext context,
ProcessPriority priority,
TabId openerTabId)
returns (ContentParentId cpId, bool isForApp, bool isForBrowser, TabId tabId);
sync BridgeToChildProcess(ContentParentId cpId);
async CreateGMPService();
- sync IsGMPPresentOnDisk(nsString keySystem, nsCString version)
- returns (bool isPresent, nsCString message);
/**
* This call connects the content process to a plugin process. While this
* call runs, a new PluginModuleParent will be created in the ContentChild
* via bridging. The corresponding PluginModuleChild will live in the plugin
* process.
*/
sync LoadPlugin(uint32_t aPluginId) returns (nsresult aResult, uint32_t aRunID);
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -1,15 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/MediaKeySystemAccess.h"
#include "mozilla/dom/MediaKeySystemAccessBinding.h"
#include "mozilla/Preferences.h"
#include "MediaPrefs.h"
#include "nsContentTypeParser.h"
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#endif
@@ -116,116 +115,16 @@ HaveGMPFor(mozIGeckoMediaPluginService*
if (NS_FAILED(aGMPService->HasPluginForAPI(aAPI,
&tags,
&hasPlugin))) {
return false;
}
return hasPlugin;
}
-#ifdef XP_WIN
-static bool
-AdobePluginFileExists(const nsACString& aVersionStr,
- const nsAString& aFilename)
-{
- MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
-
- 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"));
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return false;
- }
-
- rv = path->AppendNative(aVersionStr);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return false;
- }
-
- 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 */ bool
-MediaKeySystemAccess::IsGMPPresentOnDisk(const nsAString& aKeySystem,
- const nsACString& aVersion,
- nsACString& aOutMessage)
-{
- MOZ_ASSERT(NS_IsMainThread());
-
- if (XRE_GetProcessType() != GeckoProcessType_Default) {
- // We need to be able to access the filesystem, so call this in the
- // main process via ContentChild.
- ContentChild* contentChild = ContentChild::GetSingleton();
- if (NS_WARN_IF(!contentChild)) {
- return false;
- }
-
- nsCString message;
- bool result = false;
- bool ok = contentChild->SendIsGMPPresentOnDisk(nsString(aKeySystem), nsCString(aVersion),
- &result, &message);
- aOutMessage = message;
- return ok && result;
- }
-
- bool isPresent = true;
-
-#if XP_WIN
- if (IsPrimetimeKeySystem(aKeySystem)) {
- if (!AdobePluginDLLExists(aVersion)) {
- NS_WARNING("Adobe EME plugin disappeared from disk!");
- aOutMessage = NS_LITERAL_CSTRING("Adobe DLL was expected to be on disk but was not");
- isPresent = false;
- }
- if (!AdobePluginVoucherExists(aVersion)) {
- NS_WARNING("Adobe EME voucher disappeared from disk!");
- aOutMessage = NS_LITERAL_CSTRING("Adobe plugin voucher was expected to be on disk but was not");
- isPresent = false;
- }
-
- if (!isPresent) {
- // 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");
- } else if (!EMEVoucherFileExists()) {
- // Gecko doesn't have a voucher file for the plugin-container.
- // Adobe EME isn't going to work, so don't advertise that it will.
- aOutMessage = NS_LITERAL_CSTRING("Plugin-container voucher not present");
- isPresent = false;
- }
- }
-#endif
-
- return isPresent;
-}
-
static MediaKeySystemStatus
EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
const nsAString& aKeySystem,
int32_t aMinCdmVersion,
nsACString& aOutMessage,
nsACString& aOutCdmVersion)
{
nsTArray<nsCString> tags;
@@ -242,20 +141,16 @@ EnsureMinCDMVersion(mozIGeckoMediaPlugin
aOutCdmVersion = versionStr;
if (!hasPlugin) {
aOutMessage = NS_LITERAL_CSTRING("CDM is not installed");
return MediaKeySystemStatus::Cdm_not_installed;
}
- if (!MediaKeySystemAccess::IsGMPPresentOnDisk(aKeySystem, versionStr, aOutMessage)) {
- return MediaKeySystemStatus::Cdm_not_installed;
- }
-
nsresult rv;
int32_t version = versionStr.ToInteger(&rv);
if (aMinCdmVersion != NO_CDM_VERSION &&
(NS_FAILED(rv) || version < 0 || aMinCdmVersion > version)) {
aOutMessage = NS_LITERAL_CSTRING("Installed CDM version insufficient");
return MediaKeySystemStatus::Cdm_insufficient_version;
}
--- a/dom/media/eme/MediaKeySystemAccess.h
+++ b/dom/media/eme/MediaKeySystemAccess.h
@@ -61,20 +61,16 @@ public:
static bool IsSupported(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
DecoderDoctorDiagnostics* aDiagnostics);
static void NotifyObservers(nsPIDOMWindowInner* aWindow,
const nsAString& aKeySystem,
MediaKeySystemStatus aStatus);
- static bool IsGMPPresentOnDisk(const nsAString& aKeySystem,
- const nsACString& aVersion,
- nsACString& aOutMessage);
-
static bool GetSupportedConfig(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
MediaKeySystemConfiguration& aOutConfig,
DecoderDoctorDiagnostics* aDiagnostics);
static bool KeySystemSupportsInitDataType(const nsAString& aKeySystem,
const nsAString& aInitDataType);