summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/rules.mk4
-rw-r--r--dom/base/test/mochitest.ini1
-rw-r--r--dom/media/gmp/GMPChild.cpp6
-rw-r--r--dom/media/gmp/GMPChild.h2
-rw-r--r--dom/media/gmp/GMPContentChild.cpp150
-rw-r--r--dom/media/gmp/GMPContentChild.h8
-rw-r--r--dom/media/gmp/GMPContentParent.cpp52
-rw-r--r--dom/media/gmp/GMPContentParent.h13
-rw-r--r--dom/media/gmp/GMPDecryptorChild.cpp398
-rw-r--r--dom/media/gmp/GMPDecryptorChild.h142
-rw-r--r--dom/media/gmp/GMPDecryptorParent.cpp524
-rw-r--r--dom/media/gmp/GMPDecryptorParent.h127
-rw-r--r--dom/media/gmp/GMPDecryptorProxy.h62
-rw-r--r--dom/media/gmp/GMPLoader.cpp11
-rw-r--r--dom/media/gmp/GMPLoader.h6
-rw-r--r--dom/media/gmp/GMPParent.h1
-rw-r--r--dom/media/gmp/GMPService.cpp70
-rw-r--r--dom/media/gmp/GMPService.h31
-rw-r--r--dom/media/gmp/GMPServiceParent.cpp1
-rw-r--r--dom/media/gmp/PGMPContent.ipdl5
-rw-r--r--dom/media/gmp/PGMPDecryptor.ipdl90
-rw-r--r--dom/media/gmp/moz.build6
-rw-r--r--dom/media/gmp/mozIGeckoMediaPluginService.idl33
-rw-r--r--dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp9
-rw-r--r--dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h1
-rw-r--r--dom/tests/mochitest/bugs/test_bug743615.html3
-rw-r--r--js/src/old-configure.in4
-rw-r--r--js/src/vm/StructuredClone.cpp45
-rw-r--r--old-configure.in4
-rw-r--r--python/mozbuild/mozbuild/action/generate_symbols_file.py14
30 files changed, 102 insertions, 1721 deletions
diff --git a/config/rules.mk b/config/rules.mk
index b2fafc5762..b774063699 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -411,6 +411,10 @@ EXTRA_DSO_LDOPTS += -Wl,--version-script,$(SYMBOLS_FILE)
else
ifeq ($(OS_TARGET),Darwin)
EXTRA_DSO_LDOPTS += -Wl,-exported_symbols_list,$(SYMBOLS_FILE)
+else
+ifeq ($(OS_TARGET),SunOS)
+EXTRA_DSO_LDOPTS += -Wl,-M,$(SYMBOLS_FILE)
+endif
endif
endif
endif
diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini
index 27a970c21a..6f5e0ea835 100644
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -764,6 +764,7 @@ skip-if = debug == false
[test_setting_opener.html]
[test_simplecontentpolicy.html]
skip-if = e10s # Bug 1156489.
+[test_structuredclone_backref.html]
[test_text_wholeText.html]
[test_textnode_normalize_in_selection.html]
[test_textnode_split_in_selection.html]
diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp
index 0bf9d44036..1b02a0c244 100644
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -10,7 +10,6 @@
#include "GMPVideoDecoderChild.h"
#include "GMPVideoEncoderChild.h"
#include "GMPAudioDecoderChild.h"
-#include "GMPDecryptorChild.h"
#include "GMPVideoHost.h"
#include "nsDebugImpl.h"
#include "nsIFile.h"
@@ -164,13 +163,12 @@ GMPChild::RecvSetNodeId(const nsCString& aNodeId)
GMPErr
GMPChild::GetAPI(const char* aAPIName,
void* aHostAPI,
- void** aPluginAPI,
- uint32_t aDecryptorId)
+ void** aPluginAPI)
{
if (!mGMPLoader) {
return GMPGenericErr;
}
- return mGMPLoader->GetAPI(aAPIName, aHostAPI, aPluginAPI, aDecryptorId);
+ return mGMPLoader->GetAPI(aAPIName, aHostAPI, aPluginAPI);
}
bool
diff --git a/dom/media/gmp/GMPChild.h b/dom/media/gmp/GMPChild.h
index 722e4c7a91..a807564f72 100644
--- a/dom/media/gmp/GMPChild.h
+++ b/dom/media/gmp/GMPChild.h
@@ -69,7 +69,7 @@ private:
void ActorDestroy(ActorDestroyReason aWhy) override;
void ProcessingError(Result aCode, const char* aReason) override;
- GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI, uint32_t aDecryptorId = 0);
+ GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI);
nsTArray<UniquePtr<GMPContentChild>> mGMPContentChildren;
diff --git a/dom/media/gmp/GMPContentChild.cpp b/dom/media/gmp/GMPContentChild.cpp
index 415736e11a..9155d9bf4d 100644
--- a/dom/media/gmp/GMPContentChild.cpp
+++ b/dom/media/gmp/GMPContentChild.cpp
@@ -6,7 +6,6 @@
#include "GMPContentChild.h"
#include "GMPChild.h"
#include "GMPAudioDecoderChild.h"
-#include "GMPDecryptorChild.h"
#include "GMPVideoDecoderChild.h"
#include "GMPVideoEncoderChild.h"
#include "base/task.h"
@@ -62,25 +61,8 @@ GMPContentChild::DeallocPGMPAudioDecoderChild(PGMPAudioDecoderChild* aActor)
return true;
}
-PGMPDecryptorChild*
-GMPContentChild::AllocPGMPDecryptorChild()
-{
- GMPDecryptorChild* actor = new GMPDecryptorChild(this,
- mGMPChild->mPluginVoucher,
- mGMPChild->mSandboxVoucher);
- actor->AddRef();
- return actor;
-}
-
-bool
-GMPContentChild::DeallocPGMPDecryptorChild(PGMPDecryptorChild* aActor)
-{
- static_cast<GMPDecryptorChild*>(aActor)->Release();
- return true;
-}
-
PGMPVideoDecoderChild*
-GMPContentChild::AllocPGMPVideoDecoderChild(const uint32_t& aDecryptorId)
+GMPContentChild::AllocPGMPVideoDecoderChild()
{
GMPVideoDecoderChild* actor = new GMPVideoDecoderChild(this);
actor->AddRef();
@@ -109,124 +91,6 @@ GMPContentChild::DeallocPGMPVideoEncoderChild(PGMPVideoEncoderChild* aActor)
return true;
}
-// Adapts GMPDecryptor7 to the current GMPDecryptor version.
-class GMPDecryptor7BackwardsCompat : public GMPDecryptor {
-public:
- explicit GMPDecryptor7BackwardsCompat(GMPDecryptor7* aDecryptorV7)
- : mDecryptorV7(aDecryptorV7)
- {
- }
-
- void Init(GMPDecryptorCallback* aCallback,
- bool aDistinctiveIdentifierRequired,
- bool aPersistentStateRequired) override
- {
- // Distinctive identifier and persistent state arguments not present
- // in v7 interface.
- mDecryptorV7->Init(aCallback);
- }
-
- void CreateSession(uint32_t aCreateSessionToken,
- uint32_t aPromiseId,
- const char* aInitDataType,
- uint32_t aInitDataTypeSize,
- const uint8_t* aInitData,
- uint32_t aInitDataSize,
- GMPSessionType aSessionType) override
- {
- mDecryptorV7->CreateSession(aCreateSessionToken,
- aPromiseId,
- aInitDataType,
- aInitDataTypeSize,
- aInitData,
- aInitDataSize,
- aSessionType);
- }
-
- void LoadSession(uint32_t aPromiseId,
- const char* aSessionId,
- uint32_t aSessionIdLength) override
- {
- mDecryptorV7->LoadSession(aPromiseId, aSessionId, aSessionIdLength);
- }
-
- void UpdateSession(uint32_t aPromiseId,
- const char* aSessionId,
- uint32_t aSessionIdLength,
- const uint8_t* aResponse,
- uint32_t aResponseSize) override
- {
- mDecryptorV7->UpdateSession(aPromiseId,
- aSessionId,
- aSessionIdLength,
- aResponse,
- aResponseSize);
- }
-
- void CloseSession(uint32_t aPromiseId,
- const char* aSessionId,
- uint32_t aSessionIdLength) override
- {
- mDecryptorV7->CloseSession(aPromiseId, aSessionId, aSessionIdLength);
- }
-
- void RemoveSession(uint32_t aPromiseId,
- const char* aSessionId,
- uint32_t aSessionIdLength) override
- {
- mDecryptorV7->RemoveSession(aPromiseId, aSessionId, aSessionIdLength);
- }
-
- void SetServerCertificate(uint32_t aPromiseId,
- const uint8_t* aServerCert,
- uint32_t aServerCertSize) override
- {
- mDecryptorV7->SetServerCertificate(aPromiseId, aServerCert, aServerCertSize);
- }
-
- void Decrypt(GMPBuffer* aBuffer,
- GMPEncryptedBufferMetadata* aMetadata) override
- {
- mDecryptorV7->Decrypt(aBuffer, aMetadata);
- }
-
- void DecryptingComplete() override
- {
- mDecryptorV7->DecryptingComplete();
- delete this;
- }
-private:
- GMPDecryptor7* mDecryptorV7;
-};
-
-bool
-GMPContentChild::RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor)
-{
- GMPDecryptorChild* child = static_cast<GMPDecryptorChild*>(aActor);
- GMPDecryptorHost* host = static_cast<GMPDecryptorHost*>(child);
-
- void* ptr = nullptr;
- GMPErr err = mGMPChild->GetAPI(GMP_API_DECRYPTOR, host, &ptr, aActor->Id());
- GMPDecryptor* decryptor = nullptr;
- if (GMP_SUCCEEDED(err) && ptr) {
- decryptor = static_cast<GMPDecryptor*>(ptr);
- } else if (err != GMPNoErr) {
- // We Adapt the previous GMPDecryptor version to the current, so that
- // Gecko thinks it's only talking to the current version. v7 differs
- // from v9 in its Init() function arguments, and v9 has extra enumeration
- // members at the end of the key status enumerations.
- err = mGMPChild->GetAPI(GMP_API_DECRYPTOR_BACKWARDS_COMPAT, host, &ptr);
- if (err != GMPNoErr || !ptr) {
- return false;
- }
- decryptor = new GMPDecryptor7BackwardsCompat(static_cast<GMPDecryptor7*>(ptr));
- }
-
- child->Init(decryptor);
-
- return true;
-}
-
bool
GMPContentChild::RecvPGMPAudioDecoderConstructor(PGMPAudioDecoderChild* aActor)
{
@@ -244,13 +108,12 @@ GMPContentChild::RecvPGMPAudioDecoderConstructor(PGMPAudioDecoderChild* aActor)
}
bool
-GMPContentChild::RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* aActor,
- const uint32_t& aDecryptorId)
+GMPContentChild::RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* aActor)
{
auto vdc = static_cast<GMPVideoDecoderChild*>(aActor);
void* vd = nullptr;
- GMPErr err = mGMPChild->GetAPI(GMP_API_VIDEO_DECODER, &vdc->Host(), &vd, aDecryptorId);
+ GMPErr err = mGMPChild->GetAPI(GMP_API_VIDEO_DECODER, &vdc->Host(), &vd);
if (err != GMPNoErr || !vd) {
NS_WARNING("GMPGetAPI call failed trying to construct decoder.");
return false;
@@ -288,12 +151,6 @@ GMPContentChild::CloseActive()
iter.Get()->GetKey()->SendShutdown();
}
- const ManagedContainer<PGMPDecryptorChild>& decryptors =
- ManagedPGMPDecryptorChild();
- for (auto iter = decryptors.ConstIter(); !iter.Done(); iter.Next()) {
- iter.Get()->GetKey()->SendShutdown();
- }
-
const ManagedContainer<PGMPVideoDecoderChild>& videoDecoders =
ManagedPGMPVideoDecoderChild();
for (auto iter = videoDecoders.ConstIter(); !iter.Done(); iter.Next()) {
@@ -311,7 +168,6 @@ bool
GMPContentChild::IsUsed()
{
return !ManagedPGMPAudioDecoderChild().IsEmpty() ||
- !ManagedPGMPDecryptorChild().IsEmpty() ||
!ManagedPGMPVideoDecoderChild().IsEmpty() ||
!ManagedPGMPVideoEncoderChild().IsEmpty();
}
diff --git a/dom/media/gmp/GMPContentChild.h b/dom/media/gmp/GMPContentChild.h
index 7142076084..8cbcc90cd0 100644
--- a/dom/media/gmp/GMPContentChild.h
+++ b/dom/media/gmp/GMPContentChild.h
@@ -24,17 +24,13 @@ public:
MessageLoop* GMPMessageLoop();
bool RecvPGMPAudioDecoderConstructor(PGMPAudioDecoderChild* aActor) override;
- bool RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor) override;
- bool RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* aActor, const uint32_t& aDecryptorId) override;
+ bool RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* aActor) override;
bool RecvPGMPVideoEncoderConstructor(PGMPVideoEncoderChild* aActor) override;
PGMPAudioDecoderChild* AllocPGMPAudioDecoderChild() override;
bool DeallocPGMPAudioDecoderChild(PGMPAudioDecoderChild* aActor) override;
- PGMPDecryptorChild* AllocPGMPDecryptorChild() override;
- bool DeallocPGMPDecryptorChild(PGMPDecryptorChild* aActor) override;
-
- PGMPVideoDecoderChild* AllocPGMPVideoDecoderChild(const uint32_t& aDecryptorId) override;
+ PGMPVideoDecoderChild* AllocPGMPVideoDecoderChild() override;
bool DeallocPGMPVideoDecoderChild(PGMPVideoDecoderChild* aActor) override;
PGMPVideoEncoderChild* AllocPGMPVideoEncoderChild() override;
diff --git a/dom/media/gmp/GMPContentParent.cpp b/dom/media/gmp/GMPContentParent.cpp
index 12f6f4c48b..efc21e19e7 100644
--- a/dom/media/gmp/GMPContentParent.cpp
+++ b/dom/media/gmp/GMPContentParent.cpp
@@ -5,7 +5,6 @@
#include "GMPContentParent.h"
#include "GMPAudioDecoderParent.h"
-#include "GMPDecryptorParent.h"
#include "GMPParent.h"
#include "GMPServiceChild.h"
#include "GMPVideoDecoderParent.h"
@@ -67,7 +66,6 @@ void
GMPContentParent::ActorDestroy(ActorDestroyReason aWhy)
{
MOZ_ASSERT(mAudioDecoders.IsEmpty() &&
- mDecryptors.IsEmpty() &&
mVideoDecoders.IsEmpty() &&
mVideoEncoders.IsEmpty());
NS_DispatchToCurrentThread(new ReleaseGMPContentParent(this));
@@ -109,19 +107,9 @@ GMPContentParent::VideoEncoderDestroyed(GMPVideoEncoderParent* aEncoder)
}
void
-GMPContentParent::DecryptorDestroyed(GMPDecryptorParent* aSession)
-{
- MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
-
- MOZ_ALWAYS_TRUE(mDecryptors.RemoveElement(aSession));
- CloseIfUnused();
-}
-
-void
GMPContentParent::CloseIfUnused()
{
if (mAudioDecoders.IsEmpty() &&
- mDecryptors.IsEmpty() &&
mVideoDecoders.IsEmpty() &&
mVideoEncoders.IsEmpty()) {
RefPtr<GMPContentParent> toClose;
@@ -138,23 +126,6 @@ GMPContentParent::CloseIfUnused()
}
}
-nsresult
-GMPContentParent::GetGMPDecryptor(GMPDecryptorParent** aGMPDP)
-{
- PGMPDecryptorParent* pdp = SendPGMPDecryptorConstructor();
- if (!pdp) {
- return NS_ERROR_FAILURE;
- }
- GMPDecryptorParent* dp = static_cast<GMPDecryptorParent*>(pdp);
- // This addref corresponds to the Proxy pointer the consumer is returned.
- // It's dropped by calling Close() on the interface.
- NS_ADDREF(dp);
- mDecryptors.AppendElement(dp);
- *aGMPDP = dp;
-
- return NS_OK;
-}
-
nsIThread*
GMPContentParent::GMPThread()
{
@@ -194,11 +165,10 @@ GMPContentParent::GetGMPAudioDecoder(GMPAudioDecoderParent** aGMPAD)
}
nsresult
-GMPContentParent::GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD,
- uint32_t aDecryptorId)
+GMPContentParent::GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD)
{
// returned with one anonymous AddRef that locks it until Destroy
- PGMPVideoDecoderParent* pvdp = SendPGMPVideoDecoderConstructor(aDecryptorId);
+ PGMPVideoDecoderParent* pvdp = SendPGMPVideoDecoderConstructor();
if (!pvdp) {
return NS_ERROR_FAILURE;
}
@@ -231,7 +201,7 @@ GMPContentParent::GetGMPVideoEncoder(GMPVideoEncoderParent** aGMPVE)
}
PGMPVideoDecoderParent*
-GMPContentParent::AllocPGMPVideoDecoderParent(const uint32_t& aDecryptorId)
+GMPContentParent::AllocPGMPVideoDecoderParent()
{
GMPVideoDecoderParent* vdp = new GMPVideoDecoderParent(this);
NS_ADDREF(vdp);
@@ -262,22 +232,6 @@ GMPContentParent::DeallocPGMPVideoEncoderParent(PGMPVideoEncoderParent* aActor)
return true;
}
-PGMPDecryptorParent*
-GMPContentParent::AllocPGMPDecryptorParent()
-{
- GMPDecryptorParent* ksp = new GMPDecryptorParent(this);
- NS_ADDREF(ksp);
- return ksp;
-}
-
-bool
-GMPContentParent::DeallocPGMPDecryptorParent(PGMPDecryptorParent* aActor)
-{
- GMPDecryptorParent* ksp = static_cast<GMPDecryptorParent*>(aActor);
- NS_RELEASE(ksp);
- return true;
-}
-
PGMPAudioDecoderParent*
GMPContentParent::AllocPGMPAudioDecoderParent()
{
diff --git a/dom/media/gmp/GMPContentParent.h b/dom/media/gmp/GMPContentParent.h
index 81f79bc73d..e53d811038 100644
--- a/dom/media/gmp/GMPContentParent.h
+++ b/dom/media/gmp/GMPContentParent.h
@@ -14,7 +14,6 @@ namespace mozilla {
namespace gmp {
class GMPAudioDecoderParent;
-class GMPDecryptorParent;
class GMPParent;
class GMPVideoDecoderParent;
class GMPVideoEncoderParent;
@@ -27,16 +26,12 @@ public:
explicit GMPContentParent(GMPParent* aParent = nullptr);
- nsresult GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD,
- uint32_t aDecryptorId);
+ nsresult GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD);
void VideoDecoderDestroyed(GMPVideoDecoderParent* aDecoder);
nsresult GetGMPVideoEncoder(GMPVideoEncoderParent** aGMPVE);
void VideoEncoderDestroyed(GMPVideoEncoderParent* aEncoder);
- nsresult GetGMPDecryptor(GMPDecryptorParent** aGMPKS);
- void DecryptorDestroyed(GMPDecryptorParent* aSession);
-
nsresult GetGMPAudioDecoder(GMPAudioDecoderParent** aGMPAD);
void AudioDecoderDestroyed(GMPAudioDecoderParent* aDecoder);
@@ -67,15 +62,12 @@ private:
void ActorDestroy(ActorDestroyReason aWhy) override;
- PGMPVideoDecoderParent* AllocPGMPVideoDecoderParent(const uint32_t& aDecryptorId) override;
+ PGMPVideoDecoderParent* AllocPGMPVideoDecoderParent() override;
bool DeallocPGMPVideoDecoderParent(PGMPVideoDecoderParent* aActor) override;
PGMPVideoEncoderParent* AllocPGMPVideoEncoderParent() override;
bool DeallocPGMPVideoEncoderParent(PGMPVideoEncoderParent* aActor) override;
- PGMPDecryptorParent* AllocPGMPDecryptorParent() override;
- bool DeallocPGMPDecryptorParent(PGMPDecryptorParent* aActor) override;
-
PGMPAudioDecoderParent* AllocPGMPAudioDecoderParent() override;
bool DeallocPGMPAudioDecoderParent(PGMPAudioDecoderParent* aActor) override;
@@ -89,7 +81,6 @@ private:
nsTArray<RefPtr<GMPVideoDecoderParent>> mVideoDecoders;
nsTArray<RefPtr<GMPVideoEncoderParent>> mVideoEncoders;
- nsTArray<RefPtr<GMPDecryptorParent>> mDecryptors;
nsTArray<RefPtr<GMPAudioDecoderParent>> mAudioDecoders;
nsCOMPtr<nsIThread> mGMPThread;
RefPtr<GMPParent> mParent;
diff --git a/dom/media/gmp/GMPDecryptorChild.cpp b/dom/media/gmp/GMPDecryptorChild.cpp
deleted file mode 100644
index a1b561ab59..0000000000
--- a/dom/media/gmp/GMPDecryptorChild.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "GMPDecryptorChild.h"
-#include "GMPContentChild.h"
-#include "GMPChild.h"
-#include "base/task.h"
-#include "mozilla/TimeStamp.h"
-#include "mozilla/Unused.h"
-#include "runnable_utils.h"
-#include <ctime>
-
-#define ON_GMP_THREAD() (mPlugin->GMPMessageLoop() == MessageLoop::current())
-
-#define CALL_ON_GMP_THREAD(_func, ...) \
- CallOnGMPThread(&GMPDecryptorChild::_func, __VA_ARGS__)
-
-namespace mozilla {
-namespace gmp {
-
-GMPDecryptorChild::GMPDecryptorChild(GMPContentChild* aPlugin,
- const nsTArray<uint8_t>& aPluginVoucher,
- const nsTArray<uint8_t>& aSandboxVoucher)
- : mSession(nullptr)
- , mPlugin(aPlugin)
- , mPluginVoucher(aPluginVoucher)
- , mSandboxVoucher(aSandboxVoucher)
-{
- MOZ_ASSERT(mPlugin);
-}
-
-GMPDecryptorChild::~GMPDecryptorChild()
-{
-}
-
-template <typename MethodType, typename... ParamType>
-void
-GMPDecryptorChild::CallMethod(MethodType aMethod, ParamType&&... aParams)
-{
- MOZ_ASSERT(ON_GMP_THREAD());
- // Don't send IPC messages after tear-down.
- if (mSession) {
- (this->*aMethod)(Forward<ParamType>(aParams)...);
- }
-}
-
-template<typename T>
-struct AddConstReference {
- typedef const typename RemoveReference<T>::Type& Type;
-};
-
-template<typename MethodType, typename... ParamType>
-void
-GMPDecryptorChild::CallOnGMPThread(MethodType aMethod, ParamType&&... aParams)
-{
- if (ON_GMP_THREAD()) {
- // Use forwarding reference when we can.
- CallMethod(aMethod, Forward<ParamType>(aParams)...);
- } else {
- // Use const reference when we have to.
- auto m = &GMPDecryptorChild::CallMethod<
- decltype(aMethod), typename AddConstReference<ParamType>::Type...>;
- RefPtr<mozilla::Runnable> t =
- dont_add_new_uses_of_this::NewRunnableMethod(this, m, aMethod, Forward<ParamType>(aParams)...);
- mPlugin->GMPMessageLoop()->PostTask(t.forget());
- }
-}
-
-void
-GMPDecryptorChild::Init(GMPDecryptor* aSession)
-{
- MOZ_ASSERT(aSession);
- mSession = aSession;
-}
-
-void
-GMPDecryptorChild::SetSessionId(uint32_t aCreateSessionToken,
- const char* aSessionId,
- uint32_t aSessionIdLength)
-{
- CALL_ON_GMP_THREAD(SendSetSessionId,
- aCreateSessionToken, nsCString(aSessionId, aSessionIdLength));
-}
-
-void
-GMPDecryptorChild::ResolveLoadSessionPromise(uint32_t aPromiseId,
- bool aSuccess)
-{
- CALL_ON_GMP_THREAD(SendResolveLoadSessionPromise, aPromiseId, aSuccess);
-}
-
-void
-GMPDecryptorChild::ResolvePromise(uint32_t aPromiseId)
-{
- CALL_ON_GMP_THREAD(SendResolvePromise, aPromiseId);
-}
-
-void
-GMPDecryptorChild::RejectPromise(uint32_t aPromiseId,
- GMPDOMException aException,
- const char* aMessage,
- uint32_t aMessageLength)
-{
- CALL_ON_GMP_THREAD(SendRejectPromise,
- aPromiseId, aException, nsCString(aMessage, aMessageLength));
-}
-
-void
-GMPDecryptorChild::SessionMessage(const char* aSessionId,
- uint32_t aSessionIdLength,
- GMPSessionMessageType aMessageType,
- const uint8_t* aMessage,
- uint32_t aMessageLength)
-{
- nsTArray<uint8_t> msg;
- msg.AppendElements(aMessage, aMessageLength);
- CALL_ON_GMP_THREAD(SendSessionMessage,
- nsCString(aSessionId, aSessionIdLength),
- aMessageType, Move(msg));
-}
-
-void
-GMPDecryptorChild::ExpirationChange(const char* aSessionId,
- uint32_t aSessionIdLength,
- GMPTimestamp aExpiryTime)
-{
- CALL_ON_GMP_THREAD(SendExpirationChange,
- nsCString(aSessionId, aSessionIdLength), aExpiryTime);
-}
-
-void
-GMPDecryptorChild::SessionClosed(const char* aSessionId,
- uint32_t aSessionIdLength)
-{
- CALL_ON_GMP_THREAD(SendSessionClosed,
- nsCString(aSessionId, aSessionIdLength));
-}
-
-void
-GMPDecryptorChild::SessionError(const char* aSessionId,
- uint32_t aSessionIdLength,
- GMPDOMException aException,
- uint32_t aSystemCode,
- const char* aMessage,
- uint32_t aMessageLength)
-{
- CALL_ON_GMP_THREAD(SendSessionError,
- nsCString(aSessionId, aSessionIdLength),
- aException, aSystemCode,
- nsCString(aMessage, aMessageLength));
-}
-
-void
-GMPDecryptorChild::KeyStatusChanged(const char* aSessionId,
- uint32_t aSessionIdLength,
- const uint8_t* aKeyId,
- uint32_t aKeyIdLength,
- GMPMediaKeyStatus aStatus)
-{
- AutoTArray<uint8_t, 16> kid;
- kid.AppendElements(aKeyId, aKeyIdLength);
-
- nsTArray<GMPKeyInformation> keyInfos;
- keyInfos.AppendElement(GMPKeyInformation(kid, aStatus));
- CALL_ON_GMP_THREAD(SendBatchedKeyStatusChanged,
- nsCString(aSessionId, aSessionIdLength),
- keyInfos);
-}
-
-void
-GMPDecryptorChild::BatchedKeyStatusChanged(const char* aSessionId,
- uint32_t aSessionIdLength,
- const GMPMediaKeyInfo* aKeyInfos,
- uint32_t aKeyInfosLength)
-{
- nsTArray<GMPKeyInformation> keyInfos;
- for (uint32_t i = 0; i < aKeyInfosLength; i++) {
- nsTArray<uint8_t> keyId;
- keyId.AppendElements(aKeyInfos[i].keyid, aKeyInfos[i].keyid_size);
- keyInfos.AppendElement(GMPKeyInformation(keyId, aKeyInfos[i].status));
- }
- CALL_ON_GMP_THREAD(SendBatchedKeyStatusChanged,
- nsCString(aSessionId, aSessionIdLength),
- keyInfos);
-}
-
-void
-GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
-{
- if (!ON_GMP_THREAD()) {
- // We should run this whole method on the GMP thread since the buffer needs
- // to be deleted after the SendDecrypted call.
- mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod
- <GMPBuffer*, GMPErr>(this,
- &GMPDecryptorChild::Decrypted,
- aBuffer, aResult));
- return;
- }
-
- if (!aBuffer) {
- NS_WARNING("GMPDecryptorCallback passed bull GMPBuffer");
- return;
- }
-
- auto buffer = static_cast<GMPBufferImpl*>(aBuffer);
- if (mSession) {
- SendDecrypted(buffer->mId, aResult, buffer->mData);
- }
- delete buffer;
-}
-
-void
-GMPDecryptorChild::SetCapabilities(uint64_t aCaps)
-{
- // Deprecated.
-}
-
-void
-GMPDecryptorChild::GetSandboxVoucher(const uint8_t** aVoucher,
- uint32_t* aVoucherLength)
-{
- if (!aVoucher || !aVoucherLength) {
- return;
- }
- *aVoucher = mSandboxVoucher.Elements();
- *aVoucherLength = mSandboxVoucher.Length();
-}
-
-void
-GMPDecryptorChild::GetPluginVoucher(const uint8_t** aVoucher,
- uint32_t* aVoucherLength)
-{
- if (!aVoucher || !aVoucherLength) {
- return;
- }
- *aVoucher = mPluginVoucher.Elements();
- *aVoucherLength = mPluginVoucher.Length();
-}
-
-bool
-GMPDecryptorChild::RecvInit(const bool& aDistinctiveIdentifierRequired,
- const bool& aPersistentStateRequired)
-{
- if (!mSession) {
- return false;
- }
- mSession->Init(this, aDistinctiveIdentifierRequired, aPersistentStateRequired);
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvCreateSession(const uint32_t& aCreateSessionToken,
- const uint32_t& aPromiseId,
- const nsCString& aInitDataType,
- InfallibleTArray<uint8_t>&& aInitData,
- const GMPSessionType& aSessionType)
-{
- if (!mSession) {
- return false;
- }
-
- mSession->CreateSession(aCreateSessionToken,
- aPromiseId,
- aInitDataType.get(),
- aInitDataType.Length(),
- aInitData.Elements(),
- aInitData.Length(),
- aSessionType);
-
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvLoadSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId)
-{
- if (!mSession) {
- return false;
- }
-
- mSession->LoadSession(aPromiseId,
- aSessionId.get(),
- aSessionId.Length());
-
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvUpdateSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId,
- InfallibleTArray<uint8_t>&& aResponse)
-{
- if (!mSession) {
- return false;
- }
-
- mSession->UpdateSession(aPromiseId,
- aSessionId.get(),
- aSessionId.Length(),
- aResponse.Elements(),
- aResponse.Length());
-
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvCloseSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId)
-{
- if (!mSession) {
- return false;
- }
-
- mSession->CloseSession(aPromiseId,
- aSessionId.get(),
- aSessionId.Length());
-
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvRemoveSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId)
-{
- if (!mSession) {
- return false;
- }
-
- mSession->RemoveSession(aPromiseId,
- aSessionId.get(),
- aSessionId.Length());
-
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvSetServerCertificate(const uint32_t& aPromiseId,
- InfallibleTArray<uint8_t>&& aServerCert)
-{
- if (!mSession) {
- return false;
- }
-
- mSession->SetServerCertificate(aPromiseId,
- aServerCert.Elements(),
- aServerCert.Length());
-
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvDecrypt(const uint32_t& aId,
- InfallibleTArray<uint8_t>&& aBuffer,
- const GMPDecryptionData& aMetadata)
-{
- if (!mSession) {
- return false;
- }
-
- // Note: the GMPBufferImpl created here is deleted when the GMP passes
- // it back in the Decrypted() callback above.
- GMPBufferImpl* buffer = new GMPBufferImpl(aId, aBuffer);
-
- // |metadata| lifetime is managed by |buffer|.
- GMPEncryptedBufferDataImpl* metadata = new GMPEncryptedBufferDataImpl(aMetadata);
- buffer->SetMetadata(metadata);
-
- mSession->Decrypt(buffer, metadata);
- return true;
-}
-
-bool
-GMPDecryptorChild::RecvDecryptingComplete()
-{
- // Reset |mSession| before calling DecryptingComplete(). We should not send
- // any IPC messages during tear-down.
- auto session = mSession;
- mSession = nullptr;
-
- if (!session) {
- return false;
- }
-
- session->DecryptingComplete();
-
- Unused << Send__delete__(this);
-
- return true;
-}
-
-} // namespace gmp
-} // namespace mozilla
-
-// avoid redefined macro in unified build
-#undef ON_GMP_THREAD
-#undef CALL_ON_GMP_THREAD
diff --git a/dom/media/gmp/GMPDecryptorChild.h b/dom/media/gmp/GMPDecryptorChild.h
deleted file mode 100644
index 434da774fa..0000000000
--- a/dom/media/gmp/GMPDecryptorChild.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef GMPDecryptorChild_h_
-#define GMPDecryptorChild_h_
-
-#include "mozilla/gmp/PGMPDecryptorChild.h"
-#include "gmp-decryption.h"
-#include "mozilla/gmp/GMPTypes.h"
-#include "GMPEncryptedBufferDataImpl.h"
-#include <string>
-
-namespace mozilla {
-namespace gmp {
-
-class GMPContentChild;
-
-class GMPDecryptorChild : public GMPDecryptorCallback
- , public GMPDecryptorHost
- , public PGMPDecryptorChild
-{
-public:
- NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPDecryptorChild);
-
- explicit GMPDecryptorChild(GMPContentChild* aPlugin,
- const nsTArray<uint8_t>& aPluginVoucher,
- const nsTArray<uint8_t>& aSandboxVoucher);
-
- void Init(GMPDecryptor* aSession);
-
- // GMPDecryptorCallback
- void SetSessionId(uint32_t aCreateSessionToken,
- const char* aSessionId,
- uint32_t aSessionIdLength) override;
- void ResolveLoadSessionPromise(uint32_t aPromiseId,
- bool aSuccess) override;
- void ResolvePromise(uint32_t aPromiseId) override;
-
- void RejectPromise(uint32_t aPromiseId,
- GMPDOMException aException,
- const char* aMessage,
- uint32_t aMessageLength) override;
-
- void SessionMessage(const char* aSessionId,
- uint32_t aSessionIdLength,
- GMPSessionMessageType aMessageType,
- const uint8_t* aMessage,
- uint32_t aMessageLength) override;
-
- void ExpirationChange(const char* aSessionId,
- uint32_t aSessionIdLength,
- GMPTimestamp aExpiryTime) override;
-
- void SessionClosed(const char* aSessionId,
- uint32_t aSessionIdLength) override;
-
- void SessionError(const char* aSessionId,
- uint32_t aSessionIdLength,
- GMPDOMException aException,
- uint32_t aSystemCode,
- const char* aMessage,
- uint32_t aMessageLength) override;
-
- void KeyStatusChanged(const char* aSessionId,
- uint32_t aSessionIdLength,
- const uint8_t* aKeyId,
- uint32_t aKeyIdLength,
- GMPMediaKeyStatus aStatus) override;
-
- void SetCapabilities(uint64_t aCaps) override;
-
- void Decrypted(GMPBuffer* aBuffer, GMPErr aResult) override;
-
- void BatchedKeyStatusChanged(const char* aSessionId,
- uint32_t aSessionIdLength,
- const GMPMediaKeyInfo* aKeyInfos,
- uint32_t aKeyInfosLength) override;
-
- // GMPDecryptorHost
- void GetSandboxVoucher(const uint8_t** aVoucher,
- uint32_t* aVoucherLength) override;
-
- void GetPluginVoucher(const uint8_t** aVoucher,
- uint32_t* aVoucherLength) override;
-private:
- ~GMPDecryptorChild();
-
- // GMPDecryptorChild
- bool RecvInit(const bool& aDistinctiveIdentifierRequired,
- const bool& aPersistentStateRequired) override;
-
- bool RecvCreateSession(const uint32_t& aCreateSessionToken,
- const uint32_t& aPromiseId,
- const nsCString& aInitDataType,
- InfallibleTArray<uint8_t>&& aInitData,
- const GMPSessionType& aSessionType) override;
-
- bool RecvLoadSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId) override;
-
- bool RecvUpdateSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId,
- InfallibleTArray<uint8_t>&& aResponse) override;
-
- bool RecvCloseSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId) override;
-
- bool RecvRemoveSession(const uint32_t& aPromiseId,
- const nsCString& aSessionId) override;
-
- bool RecvDecrypt(const uint32_t& aId,
- InfallibleTArray<uint8_t>&& aBuffer,
- const GMPDecryptionData& aMetadata) override;
-
- // Resolve/reject promise on completion.
- bool RecvSetServerCertificate(const uint32_t& aPromiseId,
- InfallibleTArray<uint8_t>&& aServerCert) override;
-
- bool RecvDecryptingComplete() override;
-
- template <typename MethodType, typename... ParamType>
- void CallMethod(MethodType, ParamType&&...);
-
- template<typename MethodType, typename... ParamType>
- void CallOnGMPThread(MethodType, ParamType&&...);
-
- // GMP's GMPDecryptor implementation.
- // Only call into this on the (GMP process) main thread.
- GMPDecryptor* mSession;
- GMPContentChild* mPlugin;
-
- // Reference to the vouchers owned by the GMPChild.
- const nsTArray<uint8_t>& mPluginVoucher;
- const nsTArray<uint8_t>& mSandboxVoucher;
-};
-
-} // namespace gmp
-} // namespace mozilla
-
-#endif // GMPDecryptorChild_h_
diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp
deleted file mode 100644
index c41d5d18f5..0000000000
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ /dev/null
@@ -1,524 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "GMPDecryptorParent.h"
-
-#include "GMPContentParent.h"
-#include "GMPUtils.h"
-#include "MediaData.h"
-#include "mozilla/Unused.h"
-
-namespace mozilla {
-
-#ifdef LOG
-#undef LOG
-#endif
-
-extern LogModule* GetGMPLog();
-
-#define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
-#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
-
-namespace gmp {
-
-GMPDecryptorParent::GMPDecryptorParent(GMPContentParent* aPlugin)
- : mIsOpen(false)
- , mShuttingDown(false)
- , mActorDestroyed(false)
- , mPlugin(aPlugin)
- , mPluginId(aPlugin->GetPluginId())
- , mCallback(nullptr)
-#ifdef DEBUG
- , mGMPThread(aPlugin->GMPThread())
-#endif
-{
- MOZ_ASSERT(mPlugin && mGMPThread);
-}
-
-GMPDecryptorParent::~GMPDecryptorParent()
-{
-}
-
-nsresult
-GMPDecryptorParent::Init(GMPDecryptorProxyCallback* aCallback,
- bool aDistinctiveIdentifierRequired,
- bool aPersistentStateRequired)
-{
- LOGD(("GMPDecryptorParent[%p]::Init()", this));
-
- if (mIsOpen) {
- NS_WARNING("Trying to re-use an in-use GMP decrypter!");
- return NS_ERROR_FAILURE;
- }
- mCallback = aCallback;
- if (!SendInit(aDistinctiveIdentifierRequired, aPersistentStateRequired)) {
- return NS_ERROR_FAILURE;
- }
- mIsOpen = true;
- return NS_OK;
-}
-
-void
-GMPDecryptorParent::CreateSession(uint32_t aCreateSessionToken,
- uint32_t aPromiseId,
- const nsCString& aInitDataType,
- const nsTArray<uint8_t>& aInitData,
- GMPSessionType aSessionType)
-{
- LOGD(("GMPDecryptorParent[%p]::CreateSession(token=%u, promiseId=%u, aInitData='%s')",
- this, aCreateSessionToken, aPromiseId, ToBase64(aInitData).get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
- // Caller should ensure parameters passed in from JS are valid.
- MOZ_ASSERT(!aInitDataType.IsEmpty() && !aInitData.IsEmpty());
- Unused << SendCreateSession(aCreateSessionToken, aPromiseId, aInitDataType, aInitData, aSessionType);
-}
-
-void
-GMPDecryptorParent::LoadSession(uint32_t aPromiseId,
- const nsCString& aSessionId)
-{
- LOGD(("GMPDecryptorParent[%p]::LoadSession(sessionId='%s', promiseId=%u)",
- this, aSessionId.get(), aPromiseId));
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
- // Caller should ensure parameters passed in from JS are valid.
- MOZ_ASSERT(!aSessionId.IsEmpty());
- Unused << SendLoadSession(aPromiseId, aSessionId);
-}
-
-void
-GMPDecryptorParent::UpdateSession(uint32_t aPromiseId,
- const nsCString& aSessionId,
- const nsTArray<uint8_t>& aResponse)
-{
- LOGD(("GMPDecryptorParent[%p]::UpdateSession(sessionId='%s', promiseId=%u response='%s')",
- this, aSessionId.get(), aPromiseId, ToBase64(aResponse).get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
- // Caller should ensure parameters passed in from JS are valid.
- MOZ_ASSERT(!aSessionId.IsEmpty() && !aResponse.IsEmpty());
- Unused << SendUpdateSession(aPromiseId, aSessionId, aResponse);
-}
-
-void
-GMPDecryptorParent::CloseSession(uint32_t aPromiseId,
- const nsCString& aSessionId)
-{
- LOGD(("GMPDecryptorParent[%p]::CloseSession(sessionId='%s', promiseId=%u)",
- this, aSessionId.get(), aPromiseId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
- // Caller should ensure parameters passed in from JS are valid.
- MOZ_ASSERT(!aSessionId.IsEmpty());
- Unused << SendCloseSession(aPromiseId, aSessionId);
-}
-
-void
-GMPDecryptorParent::RemoveSession(uint32_t aPromiseId,
- const nsCString& aSessionId)
-{
- LOGD(("GMPDecryptorParent[%p]::RemoveSession(sessionId='%s', promiseId=%u)",
- this, aSessionId.get(), aPromiseId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
- // Caller should ensure parameters passed in from JS are valid.
- MOZ_ASSERT(!aSessionId.IsEmpty());
- Unused << SendRemoveSession(aPromiseId, aSessionId);
-}
-
-void
-GMPDecryptorParent::SetServerCertificate(uint32_t aPromiseId,
- const nsTArray<uint8_t>& aServerCert)
-{
- LOGD(("GMPDecryptorParent[%p]::SetServerCertificate(promiseId=%u)",
- this, aPromiseId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
- // Caller should ensure parameters passed in from JS are valid.
- MOZ_ASSERT(!aServerCert.IsEmpty());
- Unused << SendSetServerCertificate(aPromiseId, aServerCert);
-}
-
-void
-GMPDecryptorParent::Decrypt(uint32_t aId,
- const CryptoSample& aCrypto,
- const nsTArray<uint8_t>& aBuffer)
-{
- LOGV(("GMPDecryptorParent[%p]::Decrypt(id=%d)", this, aId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return;
- }
-
- // Caller should ensure parameters passed in are valid.
- MOZ_ASSERT(!aBuffer.IsEmpty());
-
- if (aCrypto.mValid) {
- GMPDecryptionData data(aCrypto.mKeyId,
- aCrypto.mIV,
- aCrypto.mPlainSizes,
- aCrypto.mEncryptedSizes,
- aCrypto.mSessionIds);
-
- Unused << SendDecrypt(aId, aBuffer, data);
- } else {
- GMPDecryptionData data;
- Unused << SendDecrypt(aId, aBuffer, data);
- }
-}
-
-bool
-GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
- const nsCString& aSessionId)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvSetSessionId(token=%u, sessionId='%s')",
- this, aCreateSessionId, aSessionId.get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SetSessionId(aCreateSessionId, aSessionId);
-#endif
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
- const bool& aSuccess)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)",
- this, aPromiseId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->ResolveLoadSessionPromise(aPromiseId, aSuccess);
-#endif
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvResolvePromise(promiseId=%u)",
- this, aPromiseId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->ResolvePromise(aPromiseId);
-#endif
- return true;
-}
-
-nsresult
-GMPExToNsresult(GMPDOMException aDomException) {
- switch (aDomException) {
- case kGMPNoModificationAllowedError: return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
- case kGMPNotFoundError: return NS_ERROR_DOM_NOT_FOUND_ERR;
- case kGMPNotSupportedError: return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
- case kGMPInvalidStateError: return NS_ERROR_DOM_INVALID_STATE_ERR;
- case kGMPSyntaxError: return NS_ERROR_DOM_SYNTAX_ERR;
- case kGMPInvalidModificationError: return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
- case kGMPInvalidAccessError: return NS_ERROR_DOM_INVALID_ACCESS_ERR;
- case kGMPSecurityError: return NS_ERROR_DOM_SECURITY_ERR;
- case kGMPAbortError: return NS_ERROR_DOM_ABORT_ERR;
- case kGMPQuotaExceededError: return NS_ERROR_DOM_QUOTA_EXCEEDED_ERR;
- case kGMPTimeoutError: return NS_ERROR_DOM_TIMEOUT_ERR;
- case kGMPTypeError: return NS_ERROR_DOM_TYPE_ERR;
- default: return NS_ERROR_DOM_UNKNOWN_ERR;
- }
-}
-
-bool
-GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
- const GMPDOMException& aException,
- const nsCString& aMessage)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, msg='%s')",
- this, aPromiseId, aException, aMessage.get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage);
-#endif
- return true;
-}
-
-#ifdef MOZ_EME
-static dom::MediaKeyMessageType
-ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
- switch (aMessageType) {
- case kGMPLicenseRequest: return dom::MediaKeyMessageType::License_request;
- case kGMPLicenseRenewal: return dom::MediaKeyMessageType::License_renewal;
- case kGMPLicenseRelease: return dom::MediaKeyMessageType::License_release;
- case kGMPIndividualizationRequest: return dom::MediaKeyMessageType::Individualization_request;
- default: return dom::MediaKeyMessageType::License_request;
- };
-};
-#endif
-
-bool
-GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
- const GMPSessionMessageType& aMessageType,
- nsTArray<uint8_t>&& aMessage)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
- this, aSessionId.get(), aMessageType, ToBase64(aMessage).get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
-#endif
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
- const double& aExpiryTime)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
- this, aSessionId.get(), aExpiryTime));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->ExpirationChange(aSessionId, aExpiryTime);
-#endif
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvSessionClosed(sessionId='%s')",
- this, aSessionId.get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SessionClosed(aSessionId);
-#endif
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
- const GMPDOMException& aException,
- const uint32_t& aSystemCode,
- const nsCString& aMessage)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', exception=%d, sysCode=%d, msg='%s')",
- this, aSessionId.get(),
- aException, aSystemCode, aMessage.get()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SessionError(aSessionId,
- GMPExToNsresult(aException),
- aSystemCode,
- aMessage);
-#endif
- return true;
-}
-
-#ifdef MOZ_EME
-static dom::MediaKeyStatus
-ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
- switch (aStatus) {
- case kGMPUsable: return dom::MediaKeyStatus::Usable;
- case kGMPExpired: return dom::MediaKeyStatus::Expired;
- case kGMPOutputDownscaled: return dom::MediaKeyStatus::Output_downscaled;
- case kGMPOutputRestricted: return dom::MediaKeyStatus::Output_restricted;
- case kGMPInternalError: return dom::MediaKeyStatus::Internal_error;
- case kGMPReleased: return dom::MediaKeyStatus::Released;
- case kGMPStatusPending: return dom::MediaKeyStatus::Status_pending;
- default: return dom::MediaKeyStatus::Internal_error;
- }
-}
-#endif
-
-bool
-GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
- InfallibleTArray<GMPKeyInformation>&& aKeyInfos)
-{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', KeyInfos len='%d')",
- this, aSessionId.get(), aKeyInfos.Length()));
-
- if (mIsOpen) {
- nsTArray<CDMKeyInfo> cdmKeyInfos(aKeyInfos.Length());
- for (uint32_t i = 0; i < aKeyInfos.Length(); i++) {
- LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, gmp-status=%d)",
- this, ToBase64(aKeyInfos[i].keyId()).get(), aKeyInfos[i].status()));
- // If the status is kGMPUnknown, we're going to forget(remove) that key info.
- if (aKeyInfos[i].status() != kGMPUnknown) {
- auto status = ToMediaKeyStatus(aKeyInfos[i].status());
- cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId(),
- dom::Optional<dom::MediaKeyStatus>(status)));
- } else {
- cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId()));
- }
- }
- mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos);
- }
-#endif
- return true;
-}
-
-#ifdef MOZ_EME
-DecryptStatus
-ToDecryptStatus(GMPErr aError)
-{
- switch (aError) {
- case GMPNoErr: return Ok;
- case GMPNoKeyErr: return NoKeyErr;
- case GMPAbortedErr: return AbortedErr;
- default: return GenericErr;
- }
-}
-#endif
-
-bool
-GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
- const GMPErr& aErr,
- InfallibleTArray<uint8_t>&& aBuffer)
-{
-#ifdef MOZ_EME
- LOGV(("GMPDecryptorParent[%p]::RecvDecrypted(id=%d, err=%d)",
- this, aId, aErr));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->Decrypted(aId, ToDecryptStatus(aErr), aBuffer);
-#endif
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvShutdown()
-{
- LOGD(("GMPDecryptorParent[%p]::RecvShutdown()", this));
-
- Shutdown();
- return true;
-}
-
-// Note: may be called via Terminated()
-void
-GMPDecryptorParent::Close()
-{
- LOGD(("GMPDecryptorParent[%p]::Close()", this));
- MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
-
- // Consumer is done with us; we can shut down. No more callbacks should
- // be made to mCallback. Note: do this before Shutdown()!
- mCallback = nullptr;
- // Let Shutdown mark us as dead so it knows if we had been alive
-
- // In case this is the last reference
- RefPtr<GMPDecryptorParent> kungfudeathgrip(this);
- this->Release();
- Shutdown();
-}
-
-void
-GMPDecryptorParent::Shutdown()
-{
- LOGD(("GMPDecryptorParent[%p]::Shutdown()", this));
- MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
-
- if (mShuttingDown) {
- return;
- }
- mShuttingDown = true;
-
- // Notify client we're gone! Won't occur after Close()
- if (mCallback) {
- mCallback->Terminated();
- mCallback = nullptr;
- }
-
- mIsOpen = false;
- if (!mActorDestroyed) {
- Unused << SendDecryptingComplete();
- }
-}
-
-// Note: Keep this sync'd up with Shutdown
-void
-GMPDecryptorParent::ActorDestroy(ActorDestroyReason aWhy)
-{
- LOGD(("GMPDecryptorParent[%p]::ActorDestroy(reason=%d)", this, aWhy));
-
- mIsOpen = false;
- mActorDestroyed = true;
- if (mCallback) {
- // May call Close() (and Shutdown()) immediately or with a delay
- mCallback->Terminated();
- mCallback = nullptr;
- }
- if (mPlugin) {
- mPlugin->DecryptorDestroyed(this);
- mPlugin = nullptr;
- }
- MaybeDisconnect(aWhy == AbnormalShutdown);
-}
-
-bool
-GMPDecryptorParent::Recv__delete__()
-{
- LOGD(("GMPDecryptorParent[%p]::Recv__delete__()", this));
-
- if (mPlugin) {
- mPlugin->DecryptorDestroyed(this);
- mPlugin = nullptr;
- }
- return true;
-}
-
-} // namespace gmp
-} // namespace mozilla
diff --git a/dom/media/gmp/GMPDecryptorParent.h b/dom/media/gmp/GMPDecryptorParent.h
deleted file mode 100644
index 3acf7dbd96..0000000000
--- a/dom/media/gmp/GMPDecryptorParent.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef GMPDecryptorParent_h_
-#define GMPDecryptorParent_h_
-
-#include "mozilla/gmp/PGMPDecryptorParent.h"
-#include "mozilla/RefPtr.h"
-#include "gmp-decryption.h"
-#include "GMPDecryptorProxy.h"
-#include "GMPCrashHelperHolder.h"
-
-namespace mozilla {
-
-class CryptoSample;
-
-namespace gmp {
-
-class GMPContentParent;
-
-class GMPDecryptorParent final : public GMPDecryptorProxy
- , public PGMPDecryptorParent
- , public GMPCrashHelperHolder
-{
-public:
- NS_INLINE_DECL_REFCOUNTING(GMPDecryptorParent)
-
- explicit GMPDecryptorParent(GMPContentParent *aPlugin);
-
- // GMPDecryptorProxy
-
- uint32_t GetPluginId() const override { return mPluginId; }
-
- nsresult Init(GMPDecryptorProxyCallback* aCallback,
- bool aDistinctiveIdentifierRequired,
- bool aPersistentStateRequired) override;
-
- void CreateSession(uint32_t aCreateSessionToken,
- uint32_t aPromiseId,
- const nsCString& aInitDataType,
- const nsTArray<uint8_t>& aInitData,
- GMPSessionType aSessionType) override;
-
- void LoadSession(uint32_t aPromiseId,
- const nsCString& aSessionId) override;
-
- void UpdateSession(uint32_t aPromiseId,
- const nsCString& aSessionId,
- const nsTArray<uint8_t>& aResponse) override;
-
- void CloseSession(uint32_t aPromiseId,
- const nsCString& aSessionId) override;
-
- void RemoveSession(uint32_t aPromiseId,
- const nsCString& aSessionId) override;
-
- void SetServerCertificate(uint32_t aPromiseId,
- const nsTArray<uint8_t>& aServerCert) override;
-
- void Decrypt(uint32_t aId,
- const CryptoSample& aCrypto,
- const nsTArray<uint8_t>& aBuffer) override;
-
- void Close() override;
-
- void Shutdown();
-
-private:
- ~GMPDecryptorParent();
-
- // PGMPDecryptorParent
-
- bool RecvSetSessionId(const uint32_t& aCreateSessionToken,
- const nsCString& aSessionId) override;
-
- bool RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
- const bool& aSuccess) override;
-
- bool RecvResolvePromise(const uint32_t& aPromiseId) override;
-
- bool RecvRejectPromise(const uint32_t& aPromiseId,
- const GMPDOMException& aException,
- const nsCString& aMessage) override;
-
- bool RecvSessionMessage(const nsCString& aSessionId,
- const GMPSessionMessageType& aMessageType,
- nsTArray<uint8_t>&& aMessage) override;
-
- bool RecvExpirationChange(const nsCString& aSessionId,
- const double& aExpiryTime) override;
-
- bool RecvSessionClosed(const nsCString& aSessionId) override;
-
- bool RecvSessionError(const nsCString& aSessionId,
- const GMPDOMException& aException,
- const uint32_t& aSystemCode,
- const nsCString& aMessage) override;
-
- bool RecvDecrypted(const uint32_t& aId,
- const GMPErr& aErr,
- InfallibleTArray<uint8_t>&& aBuffer) override;
-
- bool RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
- InfallibleTArray<GMPKeyInformation>&& aKeyInfos) override;
-
- bool RecvShutdown() override;
-
- void ActorDestroy(ActorDestroyReason aWhy) override;
- bool Recv__delete__() override;
-
- bool mIsOpen;
- bool mShuttingDown;
- bool mActorDestroyed;
- RefPtr<GMPContentParent> mPlugin;
- uint32_t mPluginId;
- GMPDecryptorProxyCallback* mCallback;
-#ifdef DEBUG
- nsIThread* const mGMPThread;
-#endif
-};
-
-} // namespace gmp
-} // namespace mozilla
-
-#endif // GMPDecryptorChild_h_
diff --git a/dom/media/gmp/GMPDecryptorProxy.h b/dom/media/gmp/GMPDecryptorProxy.h
deleted file mode 100644
index f9e34a45fd..0000000000
--- a/dom/media/gmp/GMPDecryptorProxy.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef GMPDecryptorProxy_h_
-#define GMPDecryptorProxy_h_
-
-#include "GMPCallbackBase.h"
-#include "gmp-decryption.h"
-#include "nsString.h"
-
-namespace mozilla {
-class CryptoSample;
-} // namespace mozilla
-
-class GMPDecryptorProxyCallback : public GMPCallbackBase {
-
-public:
- virtual ~GMPDecryptorProxyCallback() {}
-};
-
-class GMPDecryptorProxy {
-public:
- ~GMPDecryptorProxy() {}
-
- virtual uint32_t GetPluginId() const = 0;
-
- virtual nsresult Init(GMPDecryptorProxyCallback* aCallback,
- bool aDistinctiveIdentifierRequired,
- bool aPersistentStateRequired) = 0;
-
- virtual void CreateSession(uint32_t aCreateSessionToken,
- uint32_t aPromiseId,
- const nsCString& aInitDataType,
- const nsTArray<uint8_t>& aInitData,
- GMPSessionType aSessionType) = 0;
-
- virtual void LoadSession(uint32_t aPromiseId,
- const nsCString& aSessionId) = 0;
-
- virtual void UpdateSession(uint32_t aPromiseId,
- const nsCString& aSessionId,
- const nsTArray<uint8_t>& aResponse) = 0;
-
- virtual void CloseSession(uint32_t aPromiseId,
- const nsCString& aSessionId) = 0;
-
- virtual void RemoveSession(uint32_t aPromiseId,
- const nsCString& aSessionId) = 0;
-
- virtual void SetServerCertificate(uint32_t aPromiseId,
- const nsTArray<uint8_t>& aServerCert) = 0;
-
- virtual void Decrypt(uint32_t aId,
- const mozilla::CryptoSample& aCrypto,
- const nsTArray<uint8_t>& aBuffer) = 0;
-
- virtual void Close() = 0;
-};
-
-#endif // GMPDecryptorProxy_h_
diff --git a/dom/media/gmp/GMPLoader.cpp b/dom/media/gmp/GMPLoader.cpp
index f0437494fa..c84d71788f 100644
--- a/dom/media/gmp/GMPLoader.cpp
+++ b/dom/media/gmp/GMPLoader.cpp
@@ -38,8 +38,7 @@ public:
GMPErr GetAPI(const char* aAPIName,
void* aHostAPI,
- void** aPluginAPI,
- uint32_t aDecryptorId) override;
+ void** aPluginAPI) override;
void Shutdown() override;
@@ -78,8 +77,7 @@ public:
GMPErr GMPGetAPI(const char* aAPIName,
void* aHostAPI,
- void** aPluginAPI,
- uint32_t aDecryptorId) override
+ void** aPluginAPI) override
{
if (!mLib) {
return GMPGenericErr;
@@ -189,10 +187,9 @@ GMPLoaderImpl::Load(const char* aUTF8LibPath,
GMPErr
GMPLoaderImpl::GetAPI(const char* aAPIName,
void* aHostAPI,
- void** aPluginAPI,
- uint32_t aDecryptorId)
+ void** aPluginAPI)
{
- return mAdapter->GMPGetAPI(aAPIName, aHostAPI, aPluginAPI, aDecryptorId);
+ return mAdapter->GMPGetAPI(aAPIName, aHostAPI, aPluginAPI);
}
void
diff --git a/dom/media/gmp/GMPLoader.h b/dom/media/gmp/GMPLoader.h
index 5b6030ad7c..91989f9c24 100644
--- a/dom/media/gmp/GMPLoader.h
+++ b/dom/media/gmp/GMPLoader.h
@@ -33,8 +33,7 @@ public:
virtual GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) = 0;
virtual GMPErr GMPGetAPI(const char* aAPIName,
void* aHostAPI,
- void** aPluginAPI,
- uint32_t aDecryptorId) = 0;
+ void** aPluginAPI) = 0;
virtual void GMPShutdown() = 0;
virtual void GMPSetNodeId(const char* aNodeId, uint32_t aLength) = 0;
};
@@ -77,8 +76,7 @@ public:
// Retrieves an interface pointer from the GMP.
virtual GMPErr GetAPI(const char* aAPIName,
void* aHostAPI,
- void** aPluginAPI,
- uint32_t aDecryptorId) = 0;
+ void** aPluginAPI) = 0;
// Calls the GMPShutdown function exported by the GMP lib, and unloads the
// plugin library.
diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h
index dacd6feeba..39933765bc 100644
--- a/dom/media/gmp/GMPParent.h
+++ b/dom/media/gmp/GMPParent.h
@@ -9,7 +9,6 @@
#include "GMPProcessParent.h"
#include "GMPServiceParent.h"
#include "GMPAudioDecoderParent.h"
-#include "GMPDecryptorParent.h"
#include "GMPVideoDecoderParent.h"
#include "GMPVideoEncoderParent.h"
#include "GMPTimerParent.h"
diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp
index 1901210da1..fc3422f1f0 100644
--- a/dom/media/gmp/GMPService.cpp
+++ b/dom/media/gmp/GMPService.cpp
@@ -20,7 +20,6 @@
#include "nsNativeCharsetUtils.h"
#include "nsIConsoleService.h"
#include "mozilla/Unused.h"
-#include "GMPDecryptorParent.h"
#include "GMPAudioDecoderParent.h"
#include "nsComponentManagerUtils.h"
#include "runnable_utils.h"
@@ -346,11 +345,9 @@ class GetGMPContentParentForVideoDecoderDone : public GetGMPContentParentCallbac
{
public:
explicit GetGMPContentParentForVideoDecoderDone(UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
- GMPCrashHelper* aHelper,
- uint32_t aDecryptorId)
+ GMPCrashHelper* aHelper)
: mCallback(Move(aCallback))
, mHelper(aHelper)
- , mDecryptorId(aDecryptorId)
{
}
@@ -358,7 +355,7 @@ public:
{
GMPVideoDecoderParent* gmpVDP = nullptr;
GMPVideoHostImpl* videoHost = nullptr;
- if (aGMPParent && NS_SUCCEEDED(aGMPParent->GetGMPVideoDecoder(&gmpVDP, mDecryptorId))) {
+ if (aGMPParent && NS_SUCCEEDED(aGMPParent->GetGMPVideoDecoder(&gmpVDP))) {
videoHost = &gmpVDP->Host();
gmpVDP->SetCrashHelper(mHelper);
}
@@ -368,15 +365,13 @@ public:
private:
UniquePtr<GetGMPVideoDecoderCallback> mCallback;
RefPtr<GMPCrashHelper> mHelper;
- const uint32_t mDecryptorId;
};
NS_IMETHODIMP
-GeckoMediaPluginService::GetDecryptingGMPVideoDecoder(GMPCrashHelper* aHelper,
- nsTArray<nsCString>* aTags,
- const nsACString& aNodeId,
- UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
- uint32_t aDecryptorId)
+GeckoMediaPluginService::GetGMPVideoDecoder(GMPCrashHelper* aHelper,
+ nsTArray<nsCString>* aTags,
+ const nsACString& aNodeId,
+ UniquePtr<GetGMPVideoDecoderCallback>&& aCallback)
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
NS_ENSURE_ARG(aTags && aTags->Length() > 0);
@@ -387,7 +382,7 @@ GeckoMediaPluginService::GetDecryptingGMPVideoDecoder(GMPCrashHelper* aHelper,
}
UniquePtr<GetGMPContentParentCallback> callback(
- new GetGMPContentParentForVideoDecoderDone(Move(aCallback), aHelper, aDecryptorId));
+ new GetGMPContentParentForVideoDecoderDone(Move(aCallback), aHelper));
if (!GetContentParentFrom(aHelper,
aNodeId,
NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER),
@@ -452,57 +447,6 @@ GeckoMediaPluginService::GetGMPVideoEncoder(GMPCrashHelper* aHelper,
return NS_OK;
}
-class GetGMPContentParentForDecryptorDone : public GetGMPContentParentCallback
-{
-public:
- explicit GetGMPContentParentForDecryptorDone(UniquePtr<GetGMPDecryptorCallback>&& aCallback,
- GMPCrashHelper* aHelper)
- : mCallback(Move(aCallback))
- , mHelper(aHelper)
- {
- }
-
- void Done(GMPContentParent* aGMPParent) override
- {
- GMPDecryptorParent* ksp = nullptr;
- if (aGMPParent && NS_SUCCEEDED(aGMPParent->GetGMPDecryptor(&ksp))) {
- ksp->SetCrashHelper(mHelper);
- }
- mCallback->Done(ksp);
- }
-
-private:
- UniquePtr<GetGMPDecryptorCallback> mCallback;
- RefPtr<GMPCrashHelper> mHelper;
-};
-
-NS_IMETHODIMP
-GeckoMediaPluginService::GetGMPDecryptor(GMPCrashHelper* aHelper,
- nsTArray<nsCString>* aTags,
- const nsACString& aNodeId,
- UniquePtr<GetGMPDecryptorCallback>&& aCallback)
-{
- MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
- NS_ENSURE_ARG(aTags && aTags->Length() > 0);
- NS_ENSURE_ARG(aCallback);
-
- if (mShuttingDownOnGMPThread) {
- return NS_ERROR_FAILURE;
- }
-
- UniquePtr<GetGMPContentParentCallback> callback(
- new GetGMPContentParentForDecryptorDone(Move(aCallback), aHelper));
- if (!GetContentParentFrom(aHelper,
- aNodeId,
- NS_LITERAL_CSTRING(GMP_API_DECRYPTOR),
- *aTags,
- Move(callback))) {
- return NS_ERROR_FAILURE;
- }
-
- return NS_OK;
-}
-
void
GeckoMediaPluginService::ConnectCrashHelper(uint32_t aPluginId, GMPCrashHelper* aHelper)
{
diff --git a/dom/media/gmp/GMPService.h b/dom/media/gmp/GMPService.h
index 7ed318a25f..42ec099ef1 100644
--- a/dom/media/gmp/GMPService.h
+++ b/dom/media/gmp/GMPService.h
@@ -69,37 +69,18 @@ public:
// mozIGeckoMediaPluginService
NS_IMETHOD GetThread(nsIThread** aThread) override;
- NS_IMETHOD GetDecryptingGMPVideoDecoder(GMPCrashHelper* aHelper,
- nsTArray<nsCString>* aTags,
- const nsACString& aNodeId,
- UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
- uint32_t aDecryptorId)
- override;
+ NS_IMETHOD GetGMPVideoDecoder(GMPCrashHelper* aHelper,
+ nsTArray<nsCString>* aTags,
+ const nsACString& aNodeId,
+ UniquePtr<GetGMPVideoDecoderCallback>&& aCallback) override;
NS_IMETHOD GetGMPVideoEncoder(GMPCrashHelper* aHelper,
nsTArray<nsCString>* aTags,
const nsACString& aNodeId,
- UniquePtr<GetGMPVideoEncoderCallback>&& aCallback)
- override;
+ UniquePtr<GetGMPVideoEncoderCallback>&& aCallback) override;
NS_IMETHOD GetGMPAudioDecoder(GMPCrashHelper* aHelper,
nsTArray<nsCString>* aTags,
const nsACString& aNodeId,
- UniquePtr<GetGMPAudioDecoderCallback>&& aCallback)
- override;
- NS_IMETHOD GetGMPDecryptor(GMPCrashHelper* aHelper,
- nsTArray<nsCString>* aTags,
- const nsACString& aNodeId,
- UniquePtr<GetGMPDecryptorCallback>&& aCallback)
- override;
-
- // Helper for backwards compatibility with WebRTC/tests.
- NS_IMETHOD
- GetGMPVideoDecoder(GMPCrashHelper* aHelper,
- nsTArray<nsCString>* aTags,
- const nsACString& aNodeId,
- UniquePtr<GetGMPVideoDecoderCallback>&& aCallback) override
- {
- return GetDecryptingGMPVideoDecoder(aHelper, aTags, aNodeId, Move(aCallback), 0);
- }
+ UniquePtr<GetGMPAudioDecoderCallback>&& aCallback) override;
int32_t AsyncShutdownTimeoutMs();
diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp
index a4afbdad44..07079536fd 100644
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -22,7 +22,6 @@
#include "nsNativeCharsetUtils.h"
#include "nsIConsoleService.h"
#include "mozilla/Unused.h"
-#include "GMPDecryptorParent.h"
#include "GMPAudioDecoderParent.h"
#include "nsComponentManagerUtils.h"
#include "runnable_utils.h"
diff --git a/dom/media/gmp/PGMPContent.ipdl b/dom/media/gmp/PGMPContent.ipdl
index 00e16c02ff..b1ca2491b0 100644
--- a/dom/media/gmp/PGMPContent.ipdl
+++ b/dom/media/gmp/PGMPContent.ipdl
@@ -7,7 +7,6 @@ include protocol PGMP;
include protocol PGMPService;
include protocol PGMPVideoDecoder;
include protocol PGMPVideoEncoder;
-include protocol PGMPDecryptor;
include protocol PGMPAudioDecoder;
namespace mozilla {
@@ -18,14 +17,12 @@ intr protocol PGMPContent
bridges PGMPService, PGMP;
manages PGMPAudioDecoder;
- manages PGMPDecryptor;
manages PGMPVideoDecoder;
manages PGMPVideoEncoder;
child:
async PGMPAudioDecoder();
- async PGMPDecryptor();
- async PGMPVideoDecoder(uint32_t aDecryptorId);
+ async PGMPVideoDecoder();
async PGMPVideoEncoder();
};
diff --git a/dom/media/gmp/PGMPDecryptor.ipdl b/dom/media/gmp/PGMPDecryptor.ipdl
deleted file mode 100644
index 207933e8a6..0000000000
--- a/dom/media/gmp/PGMPDecryptor.ipdl
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 protocol PGMPContent;
-include GMPTypes;
-
-using GMPSessionMessageType from "gmp-decryption.h";
-using GMPSessionType from "gmp-decryption.h";
-using GMPDOMException from "gmp-decryption.h";
-using GMPErr from "gmp-errors.h";
-
-namespace mozilla {
-namespace gmp {
-
-async protocol PGMPDecryptor
-{
- manager PGMPContent;
-child:
-
- async Init(bool aDistinctiveIdentifierRequired,
- bool aPersistentStateRequired);
-
- async CreateSession(uint32_t aCreateSessionToken,
- uint32_t aPromiseId,
- nsCString aInitDataType,
- uint8_t[] aInitData,
- GMPSessionType aSessionType);
-
- async LoadSession(uint32_t aPromiseId,
- nsCString aSessionId);
-
- async UpdateSession(uint32_t aPromiseId,
- nsCString aSessionId,
- uint8_t[] aResponse);
-
- async CloseSession(uint32_t aPromiseId,
- nsCString aSessionId);
-
- async RemoveSession(uint32_t aPromiseId,
- nsCString aSessionId);
-
- async SetServerCertificate(uint32_t aPromiseId,
- uint8_t[] aServerCert);
-
- async Decrypt(uint32_t aId,
- uint8_t[] aBuffer,
- GMPDecryptionData aMetadata);
-
- async DecryptingComplete();
-
-parent:
- async __delete__();
-
- async SetSessionId(uint32_t aCreateSessionToken,
- nsCString aSessionId);
-
- async ResolveLoadSessionPromise(uint32_t aPromiseId,
- bool aSuccess);
-
- async ResolvePromise(uint32_t aPromiseId);
-
- async RejectPromise(uint32_t aPromiseId,
- GMPDOMException aDOMExceptionCode,
- nsCString aMessage);
-
- async SessionMessage(nsCString aSessionId,
- GMPSessionMessageType aMessageType,
- uint8_t[] aMessage);
-
- async ExpirationChange(nsCString aSessionId, double aExpiryTime);
-
- async SessionClosed(nsCString aSessionId);
-
- async SessionError(nsCString aSessionId,
- GMPDOMException aDOMExceptionCode,
- uint32_t aSystemCode,
- nsCString aMessage);
-
- async Decrypted(uint32_t aId, GMPErr aResult, uint8_t[] aBuffer);
-
- async Shutdown();
-
- async BatchedKeyStatusChanged(nsCString aSessionId,
- GMPKeyInformation[] aKeyInfos);
-};
-
-} // namespace gmp
-} // namespace mozilla
diff --git a/dom/media/gmp/moz.build b/dom/media/gmp/moz.build
index 82d091168d..697edd7037 100644
--- a/dom/media/gmp/moz.build
+++ b/dom/media/gmp/moz.build
@@ -38,9 +38,6 @@ EXPORTS += [
'GMPContentChild.h',
'GMPContentParent.h',
'GMPCrashHelperHolder.h',
- 'GMPDecryptorChild.h',
- 'GMPDecryptorParent.h',
- 'GMPDecryptorProxy.h',
'GMPEncryptedBufferDataImpl.h',
'GMPLoader.h',
'GMPMessageUtils.h',
@@ -77,8 +74,6 @@ UNIFIED_SOURCES += [
'GMPChild.cpp',
'GMPContentChild.cpp',
'GMPContentParent.cpp',
- 'GMPDecryptorChild.cpp',
- 'GMPDecryptorParent.cpp',
'GMPDiskStorage.cpp',
'GMPEncryptedBufferDataImpl.cpp',
'GMPMemoryStorage.cpp',
@@ -112,7 +107,6 @@ IPDL_SOURCES += [
'PGMP.ipdl',
'PGMPAudioDecoder.ipdl',
'PGMPContent.ipdl',
- 'PGMPDecryptor.ipdl',
'PGMPService.ipdl',
'PGMPStorage.ipdl',
'PGMPTimer.ipdl',
diff --git a/dom/media/gmp/mozIGeckoMediaPluginService.idl b/dom/media/gmp/mozIGeckoMediaPluginService.idl
index 388c581425..cf65541a92 100644
--- a/dom/media/gmp/mozIGeckoMediaPluginService.idl
+++ b/dom/media/gmp/mozIGeckoMediaPluginService.idl
@@ -11,7 +11,6 @@
#include "nsTArray.h"
#include "nsStringGlue.h"
class GMPAudioDecoderProxy;
-class GMPDecryptorProxy;
class GMPVideoDecoderProxy;
class GMPVideoEncoderProxy;
class GMPVideoHost;
@@ -33,7 +32,6 @@ public:
virtual ~GMPVideoGetterCallback() { MOZ_COUNT_DTOR(GMPVideoGetterCallback<T>); }
virtual void Done(T*, GMPVideoHost*) = 0;
};
-typedef GMPGetterCallback<GMPDecryptorProxy> GetGMPDecryptorCallback;
typedef GMPGetterCallback<GMPAudioDecoderProxy> GetGMPAudioDecoderCallback;
typedef GMPVideoGetterCallback<GMPVideoDecoderProxy> GetGMPVideoDecoderCallback;
typedef GMPVideoGetterCallback<GMPVideoEncoderProxy> GetGMPVideoEncoderCallback;
@@ -47,7 +45,6 @@ public:
%}
[ptr] native TagArray(nsTArray<nsCString>);
-native GetGMPDecryptorCallback(mozilla::UniquePtr<GetGMPDecryptorCallback>&&);
native GetGMPAudioDecoderCallback(mozilla::UniquePtr<GetGMPAudioDecoderCallback>&&);
native GetGMPVideoDecoderCallback(mozilla::UniquePtr<GetGMPVideoDecoderCallback>&&);
native GetGMPVideoEncoderCallback(mozilla::UniquePtr<GetGMPVideoEncoderCallback>&&);
@@ -94,19 +91,6 @@ interface mozIGeckoMediaPluginService : nsISupports
in GetGMPVideoDecoderCallback callback);
/**
- * Gets a video decoder as per getGMPVideoDecoder, except it is linked to
- * with a corresponding GMPDecryptor via the decryptor's ID.
- * This is a temporary measure, until we can implement a Chromium CDM
- * GMP protocol which does both decryption and decoding.
- */
- [noscript]
- void getDecryptingGMPVideoDecoder(in GMPCrashHelperPtr helper,
- in TagArray tags,
- in ACString nodeId,
- in GetGMPVideoDecoderCallback callback,
- in uint32_t decryptorId);
-
- /**
* Get a video encoder that supports the specified tags.
* The array of tags should at least contain a codec tag, and optionally
* other tags.
@@ -141,23 +125,6 @@ interface mozIGeckoMediaPluginService : nsISupports
in GetGMPAudioDecoderCallback callback);
/**
- * Returns a decryption session manager that supports the specified tags.
- * The array of tags should at least contain a key system tag, and optionally
- * other tags.
- * Callable only on GMP thread.
- * This is an asynchronous operation, the Done method of the callback object
- * will be called on the GMP thread with the result (which might be null in
- * the case of failure). This method always takes ownership of the callback
- * object, but if this method returns an error then the Done method of the
- * callback object will not be called at all.
- */
- [noscript]
- void getGMPDecryptor(in GMPCrashHelperPtr helper,
- in TagArray tags,
- in ACString nodeId,
- in GetGMPDecryptorCallback callback);
-
- /**
* Gets the NodeId for a (origin, urlbarOrigin, isInprivateBrowsing) tuple.
*/
[noscript]
diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
index 48929a6a9e..b641003b44 100644
--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
@@ -311,11 +311,10 @@ GMPVideoDecoder::Init()
nsTArray<nsCString> tags;
InitTags(tags);
UniquePtr<GetGMPVideoDecoderCallback> callback(new GMPInitDoneCallback(this));
- if (NS_FAILED(mMPS->GetDecryptingGMPVideoDecoder(mCrashHelper,
- &tags,
- GetNodeId(),
- Move(callback),
- DecryptorId()))) {
+ if (NS_FAILED(mMPS->GetGMPVideoDecoder(mCrashHelper,
+ &tags,
+ GetNodeId(),
+ Move(callback)))) {
mInitPromise.Reject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
}
diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h
index 290f02a867..7d9b8ebe2e 100644
--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h
+++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h
@@ -81,7 +81,6 @@ public:
protected:
virtual void InitTags(nsTArray<nsCString>& aTags);
virtual nsCString GetNodeId();
- virtual uint32_t DecryptorId() const { return 0; }
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
virtual const VideoInfo& GetConfig() const;
diff --git a/dom/tests/mochitest/bugs/test_bug743615.html b/dom/tests/mochitest/bugs/test_bug743615.html
index 39e978ddad..044e6509dc 100644
--- a/dom/tests/mochitest/bugs/test_bug743615.html
+++ b/dom/tests/mochitest/bugs/test_bug743615.html
@@ -54,8 +54,7 @@ function windowMessage(evt) {
ok(checkPattern(imageData, pattern),
'postMessage from self worked correctly');
- // We're not spec compliant on this yet.
- todo_is(imageData.data, evt.data.dataRef,
+ is(imageData.data, evt.data.dataRef,
'Should have backrefs for imagedata buffer');
// Make a new pattern, and send it to a worker.
diff --git a/js/src/old-configure.in b/js/src/old-configure.in
index 3a9aa80553..4f130d64c1 100644
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -925,11 +925,11 @@ case "$target" in
;;
i*86-*-solaris*)
- MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib"
+ MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/10/lib"
;;
x86_64-*-solaris*)
- MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64"
+ MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/10/lib/amd64"
;;
esac
diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp
index e99cfe8f71..daaaf52b92 100644
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -1240,7 +1240,16 @@ JSStructuredCloneWriter::traverseObject(HandleObject obj)
ESClass cls;
if (!GetBuiltinClass(context(), obj, &cls))
return false;
- return out.writePair(cls == ESClass::Array ? SCTAG_ARRAY_OBJECT : SCTAG_OBJECT_OBJECT, 0);
+
+ if (cls == ESClass::Array) {
+ uint32_t length = 0;
+ if (!JS_GetArrayLength(context(), obj, &length))
+ return false;
+
+ return out.writePair(SCTAG_ARRAY_OBJECT, NativeEndian::swapToLittleEndian(length));
+ }
+
+ return out.writePair(SCTAG_OBJECT_OBJECT, 0);
}
bool
@@ -2037,6 +2046,7 @@ bool
JSStructuredCloneReader::startRead(MutableHandleValue vp)
{
uint32_t tag, data;
+ bool alreadAppended = false;
if (!in.readPair(&tag, &data))
return false;
@@ -2143,7 +2153,7 @@ JSStructuredCloneReader::startRead(MutableHandleValue vp)
case SCTAG_ARRAY_OBJECT:
case SCTAG_OBJECT_OBJECT: {
JSObject* obj = (tag == SCTAG_ARRAY_OBJECT)
- ? (JSObject*) NewDenseEmptyArray(context())
+ ? (JSObject*) NewDenseUnallocatedArray(context(), NativeEndian::swapFromLittleEndian(data))
: (JSObject*) NewBuiltinClassInstance<PlainObject>(context());
if (!obj || !objs.append(ObjectValue(*obj)))
return false;
@@ -2237,15 +2247,29 @@ JSStructuredCloneReader::startRead(MutableHandleValue vp)
"unsupported type");
return false;
}
+
+ // callbacks->read() might read other objects from the buffer.
+ // In startWrite we always write the object itself before calling
+ // the custom function. We should do the same here to keep
+ // indexing consistent.
+ uint32_t placeholderIndex = allObjs.length();
+ Value dummy = UndefinedValue();
+ if (!allObjs.append(dummy)) {
+ return false;
+ }
+
JSObject* obj = callbacks->read(context(), this, tag, data, closure);
if (!obj)
return false;
vp.setObject(*obj);
+ allObjs[placeholderIndex].set(vp);
+ alreadAppended = true;
}
}
- if (vp.isObject() && !allObjs.append(vp))
+ if (!alreadAppended && vp.isObject() && !allObjs.append(vp)) {
return false;
+ }
return true;
}
@@ -2819,7 +2843,20 @@ JS_WriteTypedArray(JSStructuredCloneWriter* w, HandleValue v)
MOZ_ASSERT(v.isObject());
assertSameCompartment(w->context(), v);
RootedObject obj(w->context(), &v.toObject());
- return w->writeTypedArray(obj);
+
+ // startWrite can write everything, thus we should check here
+ // and report error if the user passes a wrong type.
+ if (!JS_IsTypedArrayObject(obj)) {
+ JS_ReportErrorNumberASCII(w->context(), GetErrorMessage, nullptr,
+ JSMSG_SC_BAD_SERIALIZED_DATA,
+ "expected type array");
+ return false;
+ }
+
+ // We should use startWrite instead of writeTypedArray, because
+ // typed array is an object, we should add it to the |memory|
+ // (allObjs) list. Directly calling writeTypedArray won't add it.
+ return w->startWrite(v);
}
JS_PUBLIC_API(bool)
diff --git a/old-configure.in b/old-configure.in
index 59a11f4fed..873acd83aa 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -1127,9 +1127,9 @@ dnl default mode that relies on relative symlinks being handled a certain way.
fi
if test "$CPU_ARCH" = "x86"; then
- MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib"
+ MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/10/lib"
elif test "$CPU_ARCH" = "x86_64"; then
- MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64"
+ MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/10/lib/amd64"
fi
;;
diff --git a/python/mozbuild/mozbuild/action/generate_symbols_file.py b/python/mozbuild/mozbuild/action/generate_symbols_file.py
index ff6136bb14..3eebf324cc 100644
--- a/python/mozbuild/mozbuild/action/generate_symbols_file.py
+++ b/python/mozbuild/mozbuild/action/generate_symbols_file.py
@@ -83,6 +83,20 @@ def generate_symbols_file(output, *args):
# };
output.write('{\nglobal:\n %s;\nlocal:\n *;\n};'
% ';\n '.join(symbols))
+ elif buildconfig.substs['OS_TARGET'] == 'SunOS':
+ # A linker version script is generated for Sun LD that looks like the
+ # following:
+ # $mapfile_version 2
+ # SYMBOL_VERSION SUNW_1.1 {
+ # global:
+ # symbol1;
+ # symbol2;
+ # ...
+ # local:
+ # *;
+ # };
+ output.write('$mapfile_version 2\nSYMBOL_VERSION SUNW_1.1 {\nglobal:\n %s;\nlocal:\n *;\n};'
+ % ';\n '.join(symbols))
elif buildconfig.substs['OS_TARGET'] == 'Darwin':
# A list of symbols is generated for Apple ld that simply lists all
# symbols, with an underscore prefix.