diff options
author | Matt A. Tobin <email@mattatobin.com> | 2022-04-21 00:47:41 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2022-04-21 00:47:41 -0500 |
commit | 7e0cff5c3400235b967113d8d9b97f5be19d4316 (patch) | |
tree | 51af9ba52fc43dc616cfbbcfdbecd97294a8d938 | |
parent | 08bc3833c331e69676f554cf54a00e34139ef500 (diff) | |
download | aura-central-7e0cff5c3400235b967113d8d9b97f5be19d4316.tar.gz |
Issue #25 - Part 8: Remove EME from dom/base
-rw-r--r-- | dom/base/Navigator.cpp | 141 | ||||
-rw-r--r-- | dom/base/Navigator.h | 12 | ||||
-rw-r--r-- | dom/base/nsDocument.cpp | 34 | ||||
-rw-r--r-- | dom/base/nsDocument.h | 4 |
4 files changed, 0 insertions, 191 deletions
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 11fe91b9a..e72e95a61 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -88,11 +88,6 @@ #endif #include "mozilla/dom/ContentChild.h" -#ifdef MOZ_EME -#include "mozilla/EMEUtils.h" -#include "mozilla/DetailedPromise.h" -#endif - namespace mozilla { namespace dom { @@ -195,9 +190,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) -#ifdef MOZ_EME - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager) -#endif #ifdef MOZ_GAMEPAD NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest) #endif @@ -258,13 +250,6 @@ Navigator::Invalidate() mServiceWorkerContainer = nullptr; -#ifdef MOZ_EME - if (mMediaKeySystemAccessManager) { - mMediaKeySystemAccessManager->Shutdown(); - mMediaKeySystemAccessManager = nullptr; - } -#endif - #ifdef MOZ_GAMEPAD if (mGamepadServiceTest) { mGamepadServiceTest->Shutdown(); @@ -1498,131 +1483,5 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI, return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent); } -#ifdef MOZ_EME -static nsCString -ToCString(const nsString& aString) -{ - nsCString str("'"); - str.Append(NS_ConvertUTF16toUTF8(aString)); - str.AppendLiteral("'"); - return str; -} - -static nsCString -ToCString(const MediaKeysRequirement aValue) -{ - nsCString str("'"); - str.Append(nsDependentCString(MediaKeysRequirementValues::strings[static_cast<uint32_t>(aValue)].value)); - str.AppendLiteral("'"); - return str; -} - -static nsCString -ToCString(const MediaKeySystemMediaCapability& aValue) -{ - nsCString str; - str.AppendLiteral("{contentType="); - str.Append(ToCString(aValue.mContentType)); - str.AppendLiteral(", robustness="); - str.Append(ToCString(aValue.mRobustness)); - str.AppendLiteral("}"); - return str; -} - -template<class Type> -static nsCString -ToCString(const Sequence<Type>& aSequence) -{ - nsCString str; - str.AppendLiteral("["); - for (size_t i = 0; i < aSequence.Length(); i++) { - if (i != 0) { - str.AppendLiteral(","); - } - str.Append(ToCString(aSequence[i])); - } - str.AppendLiteral("]"); - return str; -} - -template<class Type> -static nsCString -ToCString(const Optional<Sequence<Type>>& aOptional) -{ - nsCString str; - if (aOptional.WasPassed()) { - str.Append(ToCString(aOptional.Value())); - } else { - str.AppendLiteral("[]"); - } - return str; -} - -static nsCString -ToCString(const MediaKeySystemConfiguration& aConfig) -{ - nsCString str; - str.AppendLiteral("{label="); - str.Append(ToCString(aConfig.mLabel)); - - str.AppendLiteral(", initDataTypes="); - str.Append(ToCString(aConfig.mInitDataTypes)); - - str.AppendLiteral(", audioCapabilities="); - str.Append(ToCString(aConfig.mAudioCapabilities)); - - str.AppendLiteral(", videoCapabilities="); - str.Append(ToCString(aConfig.mVideoCapabilities)); - - str.AppendLiteral(", distinctiveIdentifier="); - str.Append(ToCString(aConfig.mDistinctiveIdentifier)); - - str.AppendLiteral(", persistentState="); - str.Append(ToCString(aConfig.mPersistentState)); - - str.AppendLiteral(", sessionTypes="); - str.Append(ToCString(aConfig.mSessionTypes)); - - str.AppendLiteral("}"); - - return str; -} - -static nsCString -RequestKeySystemAccessLogString(const nsAString& aKeySystem, - const Sequence<MediaKeySystemConfiguration>& aConfigs) -{ - nsCString str; - str.AppendPrintf("Navigator::RequestMediaKeySystemAccess(keySystem='%s' options=", - NS_ConvertUTF16toUTF8(aKeySystem).get()); - str.Append(ToCString(aConfigs)); - str.AppendLiteral(")"); - return str; -} - -already_AddRefed<Promise> -Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem, - const Sequence<MediaKeySystemConfiguration>& aConfigs, - ErrorResult& aRv) -{ - EME_LOG("%s", RequestKeySystemAccessLogString(aKeySystem, aConfigs).get()); - - nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow); - RefPtr<DetailedPromise> promise = - DetailedPromise::Create(go, aRv, - NS_LITERAL_CSTRING("navigator.requestMediaKeySystemAccess")); - if (aRv.Failed()) { - return nullptr; - } - - if (!mMediaKeySystemAccessManager) { - mMediaKeySystemAccessManager = new MediaKeySystemAccessManager(mWindow); - } - - mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs); - return promise.forget(); -} -#endif - } // namespace dom } // namespace mozilla diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 2915b5069..a1c4794c4 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -17,9 +17,6 @@ #include "nsString.h" #include "nsTArray.h" #include "nsWeakPtr.h" -#ifdef MOZ_EME -#include "mozilla/dom/MediaKeySystemAccessManager.h" -#endif class nsPluginArray; class nsMimeTypeArray; @@ -238,15 +235,6 @@ public: // any, else null. static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal); -#ifdef MOZ_EME - already_AddRefed<Promise> - RequestMediaKeySystemAccess(const nsAString& aKeySystem, - const Sequence<MediaKeySystemConfiguration>& aConfig, - ErrorResult& aRv); -private: - RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager; -#endif - private: virtual ~Navigator(); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 52113f4d8..08c78c88d 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -4289,32 +4289,6 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal) } } -#ifdef MOZ_EME -static void -CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME) -{ - nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aSupports)); - if (domMediaElem) { - nsCOMPtr<nsIContent> content(do_QueryInterface(domMediaElem)); - MOZ_ASSERT(content, "aSupports is not a content"); - HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(content.get()); - bool* contains = static_cast<bool*>(aContainsEME); - if (mediaElem->GetMediaKeys()) { - *contains = true; - } - } -} - -bool -nsDocument::ContainsEMEContent() -{ - bool containsEME = false; - EnumerateActivityObservers(CheckIfContainsEMEContent, - static_cast<void*>(&containsEME)); - return containsEME; -} -#endif // MOZ_EME - static void CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE) { @@ -8091,14 +8065,6 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest) return false; } -#ifdef MOZ_EME - // Don't save presentations for documents containing EME content, so that - // CDMs reliably shutdown upon user navigation. - if (ContainsEMEContent()) { - return false; - } -#endif - // Don't save presentations for documents containing MSE content, to // reduce memory usage. if (ContainsMSEContent()) { diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 010f95ae2..024aaaa7e 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -1115,10 +1115,6 @@ public: js::ExpandoAndGeneration mExpandoAndGeneration; -#ifdef MOZ_EME - bool ContainsEMEContent(); -#endif - bool ContainsMSEContent(); protected: |