Don't include MediaKeySystemAccess without EME.

This also removes checks for EME content in documents.
This removes practical use of EME by no longer having a keying system. (no-op)
tag #26
This commit is contained in:
wolfbeast 2017-12-13 00:26:07 +01:00 • committed by Roy Tam
commit 90fc779437
5 changed files with 20 additions and 0 deletions

View file

@ -97,8 +97,10 @@
#endif #endif
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#ifdef MOZ_EME
#include "mozilla/EMEUtils.h" #include "mozilla/EMEUtils.h"
#include "mozilla/DetailedPromise.h" #include "mozilla/DetailedPromise.h"
#endif
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -214,7 +216,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
#ifdef MOZ_EME
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation)
#ifdef MOZ_GAMEPAD #ifdef MOZ_GAMEPAD
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest)
@ -288,10 +292,12 @@ Navigator::Invalidate()
mServiceWorkerContainer = nullptr; mServiceWorkerContainer = nullptr;
#ifdef MOZ_EME
if (mMediaKeySystemAccessManager) { if (mMediaKeySystemAccessManager) {
mMediaKeySystemAccessManager->Shutdown(); mMediaKeySystemAccessManager->Shutdown();
mMediaKeySystemAccessManager = nullptr; mMediaKeySystemAccessManager = nullptr;
} }
#endif
#ifdef MOZ_GAMEPAD #ifdef MOZ_GAMEPAD
if (mGamepadServiceTest) { if (mGamepadServiceTest) {
@ -1884,6 +1890,7 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent); return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent);
} }
#ifdef MOZ_EME
static nsCString static nsCString
ToCString(const nsString& aString) ToCString(const nsString& aString)
{ {
@ -2009,6 +2016,7 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs); mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs);
return promise.forget(); return promise.forget();
} }
#endif
Presentation* Presentation*
Navigator::GetPresentation(ErrorResult& aRv) Navigator::GetPresentation(ErrorResult& aRv)

View file

@ -18,7 +18,9 @@
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsWeakPtr.h" #include "nsWeakPtr.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeySystemAccessManager.h" #include "mozilla/dom/MediaKeySystemAccessManager.h"
#endif
class nsPluginArray; class nsPluginArray;
class nsMimeTypeArray; class nsMimeTypeArray;
@ -258,12 +260,14 @@ public:
// any, else null. // any, else null.
static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal); static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal);
#ifdef MOZ_EME
already_AddRefed<Promise> already_AddRefed<Promise>
RequestMediaKeySystemAccess(const nsAString& aKeySystem, RequestMediaKeySystemAccess(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfig, const Sequence<MediaKeySystemConfiguration>& aConfig,
ErrorResult& aRv); ErrorResult& aRv);
private: private:
RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager; RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager;
#endif
public: public:
void NotifyVRDisplaysUpdated(); void NotifyVRDisplaysUpdated();

View file

@ -4340,6 +4340,7 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal)
} }
} }
#ifdef MOZ_EME
static void static void
CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME) CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
{ {
@ -4363,6 +4364,7 @@ nsDocument::ContainsEMEContent()
static_cast<void*>(&containsEME)); static_cast<void*>(&containsEME));
return containsEME; return containsEME;
} }
#endif // MOZ_EME
static void static void
CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE) CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
@ -8390,11 +8392,13 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
} }
#endif // MOZ_WEBRTC #endif // MOZ_WEBRTC
#ifdef MOZ_EME
// Don't save presentations for documents containing EME content, so that // Don't save presentations for documents containing EME content, so that
// CDMs reliably shutdown upon user navigation. // CDMs reliably shutdown upon user navigation.
if (ContainsEMEContent()) { if (ContainsEMEContent()) {
return false; return false;
} }
#endif
// Don't save presentations for documents containing MSE content, to // Don't save presentations for documents containing MSE content, to
// reduce memory usage. // reduce memory usage.

View file

@ -1267,7 +1267,9 @@ public:
js::ExpandoAndGeneration mExpandoAndGeneration; js::ExpandoAndGeneration mExpandoAndGeneration;
#ifdef MOZ_EME
bool ContainsEMEContent(); bool ContainsEMEContent();
#endif
bool ContainsMSEContent(); bool ContainsMSEContent();

View file

@ -348,12 +348,14 @@ partial interface Navigator {
readonly attribute LegacyMozTCPSocket mozTCPSocket; readonly attribute LegacyMozTCPSocket mozTCPSocket;
}; };
#ifdef MOZ_EME
partial interface Navigator { partial interface Navigator {
[Pref="media.eme.apiVisible", NewObject] [Pref="media.eme.apiVisible", NewObject]
Promise<MediaKeySystemAccess> Promise<MediaKeySystemAccess>
requestMediaKeySystemAccess(DOMString keySystem, requestMediaKeySystemAccess(DOMString keySystem,
sequence<MediaKeySystemConfiguration> supportedConfigurations); sequence<MediaKeySystemConfiguration> supportedConfigurations);
}; };
#endif
#ifdef NIGHTLY_BUILD #ifdef NIGHTLY_BUILD
partial interface Navigator { partial interface Navigator {