2014-06-07 00:52:15 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/CDMProxy.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "mozilla/dom/MediaKeys.h"
|
|
|
|
#include "mozilla/dom/MediaKeySession.h"
|
|
|
|
#include "mozIGeckoMediaPluginService.h"
|
|
|
|
#include "nsContentCID.h"
|
|
|
|
#include "nsServiceManagerUtils.h"
|
|
|
|
#include "MainThreadUtils.h"
|
2015-02-20 04:37:55 +03:00
|
|
|
#include "mozilla/EMEUtils.h"
|
2014-07-30 10:53:28 +04:00
|
|
|
#include "nsIConsoleService.h"
|
|
|
|
#include "prenv.h"
|
|
|
|
#include "mozilla/PodOperations.h"
|
|
|
|
#include "mozilla/CDMCallbackProxy.h"
|
2015-04-09 14:14:55 +03:00
|
|
|
#include "MediaData.h"
|
2014-06-07 00:52:15 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
CDMProxy::CDMProxy(dom::MediaKeys* aKeys, const nsAString& aKeySystem)
|
|
|
|
: mKeys(aKeys)
|
|
|
|
, mKeySystem(aKeySystem)
|
2014-07-30 10:53:28 +04:00
|
|
|
, mCDM(nullptr)
|
|
|
|
, mDecryptionJobCount(0)
|
2015-02-10 13:48:29 +03:00
|
|
|
, mShutdownCalled(false)
|
2014-06-07 00:52:15 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_COUNT_CTOR(CDMProxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
CDMProxy::~CDMProxy()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CDMProxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-10-13 02:53:43 +04:00
|
|
|
CDMProxy::Init(PromiseId aPromiseId,
|
|
|
|
const nsAString& aOrigin,
|
|
|
|
const nsAString& aTopLevelOrigin,
|
|
|
|
bool aInPrivateBrowsing)
|
2014-06-07 00:52:15 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-08-18 01:41:50 +04:00
|
|
|
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
|
2014-07-30 10:53:28 +04:00
|
|
|
|
2014-10-13 02:53:43 +04:00
|
|
|
EME_LOG("CDMProxy::Init (%s, %s) %s",
|
|
|
|
NS_ConvertUTF16toUTF8(aOrigin).get(),
|
|
|
|
NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(),
|
|
|
|
(aInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing"));
|
2014-07-30 10:53:28 +04:00
|
|
|
|
2015-04-04 07:03:16 +03:00
|
|
|
nsCString pluginVersion;
|
2014-06-07 00:52:15 +04:00
|
|
|
if (!mGMPThread) {
|
|
|
|
nsCOMPtr<mozIGeckoMediaPluginService> mps =
|
|
|
|
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
|
|
|
|
if (!mps) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Couldn't get MediaPluginService in CDMProxy::Init"));
|
2014-06-07 00:52:15 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mps->GetThread(getter_AddRefs(mGMPThread));
|
|
|
|
if (!mGMPThread) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Couldn't get GMP thread CDMProxy::Init"));
|
2014-06-07 00:52:15 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-04-04 07:03:16 +03:00
|
|
|
|
2014-10-13 02:53:43 +04:00
|
|
|
nsAutoPtr<InitData> data(new InitData());
|
|
|
|
data->mPromiseId = aPromiseId;
|
|
|
|
data->mOrigin = aOrigin;
|
|
|
|
data->mTopLevelOrigin = aTopLevelOrigin;
|
|
|
|
data->mInPrivateBrowsing = aInPrivateBrowsing;
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-10-13 02:53:43 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<InitData>>(this,
|
|
|
|
&CDMProxy::gmp_Init,
|
2015-02-10 13:48:29 +03:00
|
|
|
Move(data)));
|
2014-07-30 10:53:28 +04:00
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
bool
|
|
|
|
CDMProxy::IsOnGMPThread()
|
|
|
|
{
|
|
|
|
return NS_GetCurrentThread() == mGMPThread;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2015-02-10 13:48:29 +03:00
|
|
|
CDMProxy::gmp_InitDone(GMPDecryptorProxy* aCDM, nsAutoPtr<InitData>&& aData)
|
|
|
|
{
|
|
|
|
EME_LOG("CDMProxy::gmp_InitDone");
|
2015-06-03 04:42:50 +03:00
|
|
|
if (mShutdownCalled) {
|
2015-02-10 13:48:29 +03:00
|
|
|
if (aCDM) {
|
|
|
|
aCDM->Close();
|
|
|
|
}
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("CDMProxy was shut down before init could complete"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!aCDM) {
|
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("GetGMPDecryptor failed to return a CDM"));
|
2015-02-10 13:48:29 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mCDM = aCDM;
|
|
|
|
mCallback = new CDMCallbackProxy(this);
|
|
|
|
mCDM->Init(mCallback);
|
|
|
|
nsCOMPtr<nsIRunnable> task(
|
|
|
|
NS_NewRunnableMethodWithArg<uint32_t>(this,
|
|
|
|
&CDMProxy::OnCDMCreated,
|
|
|
|
aData->mPromiseId));
|
|
|
|
NS_DispatchToMainThread(task);
|
|
|
|
}
|
|
|
|
|
|
|
|
class gmp_InitDoneCallback : public GetGMPDecryptorCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gmp_InitDoneCallback(CDMProxy* aCDMProxy,
|
|
|
|
nsAutoPtr<CDMProxy::InitData>&& aData)
|
|
|
|
: mCDMProxy(aCDMProxy),
|
|
|
|
mData(Move(aData))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Done(GMPDecryptorProxy* aCDM)
|
|
|
|
{
|
|
|
|
mCDMProxy->gmp_InitDone(aCDM, Move(mData));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<CDMProxy> mCDMProxy;
|
|
|
|
nsAutoPtr<CDMProxy::InitData> mData;
|
|
|
|
};
|
|
|
|
|
2015-02-10 13:48:52 +03:00
|
|
|
class gmp_InitGetGMPDecryptorCallback : public GetNodeIdCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gmp_InitGetGMPDecryptorCallback(CDMProxy* aCDMProxy,
|
|
|
|
nsAutoPtr<CDMProxy::InitData>&& aData)
|
|
|
|
: mCDMProxy(aCDMProxy),
|
|
|
|
mData(aData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Done(nsresult aResult, const nsACString& aNodeId)
|
|
|
|
{
|
|
|
|
mCDMProxy->gmp_InitGetGMPDecryptor(aResult, aNodeId, Move(mData));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<CDMProxy> mCDMProxy;
|
|
|
|
nsAutoPtr<CDMProxy::InitData> mData;
|
|
|
|
};
|
|
|
|
|
2015-02-10 13:48:29 +03:00
|
|
|
void
|
|
|
|
CDMProxy::gmp_Init(nsAutoPtr<InitData>&& aData)
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
|
|
|
|
nsCOMPtr<mozIGeckoMediaPluginService> mps =
|
|
|
|
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
|
|
|
|
if (!mps) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Couldn't get MediaPluginService in CDMProxy::gmp_Init"));
|
2015-02-10 13:48:52 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make a copy before we transfer ownership of aData to the
|
|
|
|
// gmp_InitGetGMPDecryptorCallback.
|
|
|
|
InitData data(*aData);
|
|
|
|
UniquePtr<GetNodeIdCallback> callback(
|
|
|
|
new gmp_InitGetGMPDecryptorCallback(this, Move(aData)));
|
|
|
|
nsresult rv = mps->GetNodeId(data.mOrigin,
|
|
|
|
data.mTopLevelOrigin,
|
|
|
|
data.mInPrivateBrowsing,
|
|
|
|
Move(callback));
|
|
|
|
if (NS_FAILED(rv)) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(data.mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Call to GetNodeId() failed early"));
|
2015-02-10 13:48:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::gmp_InitGetGMPDecryptor(nsresult aResult,
|
|
|
|
const nsACString& aNodeId,
|
|
|
|
nsAutoPtr<InitData>&& aData)
|
|
|
|
{
|
|
|
|
uint32_t promiseID = aData->mPromiseId;
|
|
|
|
if (NS_FAILED(aResult)) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(promiseID, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("GetNodeId() called back, but with a failure result"));
|
2014-10-13 02:53:43 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-10 13:48:52 +03:00
|
|
|
mNodeId = aNodeId;
|
2014-10-13 02:53:43 +04:00
|
|
|
MOZ_ASSERT(!GetNodeId().IsEmpty());
|
2015-02-10 13:48:52 +03:00
|
|
|
|
|
|
|
nsCOMPtr<mozIGeckoMediaPluginService> mps =
|
|
|
|
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
|
|
|
|
if (!mps) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(promiseID, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Couldn't get MediaPluginService in CDMProxy::gmp_InitGetGMPDecryptor"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-10-13 02:53:43 +04:00
|
|
|
EME_LOG("CDMProxy::gmp_Init (%s, %s) %s NodeId=%s",
|
|
|
|
NS_ConvertUTF16toUTF8(aData->mOrigin).get(),
|
|
|
|
NS_ConvertUTF16toUTF8(aData->mTopLevelOrigin).get(),
|
|
|
|
(aData->mInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing"),
|
|
|
|
GetNodeId().get());
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsTArray<nsCString> tags;
|
|
|
|
tags.AppendElement(NS_ConvertUTF16toUTF8(mKeySystem));
|
2015-02-10 13:48:29 +03:00
|
|
|
|
|
|
|
UniquePtr<GetGMPDecryptorCallback> callback(new gmp_InitDoneCallback(this,
|
|
|
|
Move(aData)));
|
2015-02-10 13:48:52 +03:00
|
|
|
nsresult rv = mps->GetGMPDecryptor(&tags, GetNodeId(), Move(callback));
|
2015-02-10 13:48:29 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(promiseID, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Call to GetGMPDecryptor() failed early"));
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::OnCDMCreated(uint32_t aPromiseId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-08-18 01:41:50 +04:00
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
2014-10-13 02:53:43 +04:00
|
|
|
MOZ_ASSERT(!GetNodeId().IsEmpty());
|
2015-03-26 09:55:30 +03:00
|
|
|
if (mCDM) {
|
|
|
|
mKeys->OnCDMCreated(aPromiseId, GetNodeId(), mCDM->GetPluginId());
|
|
|
|
} else {
|
|
|
|
// No CDM? Just reject the promise.
|
2015-06-03 04:42:50 +03:00
|
|
|
mKeys->RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in OnCDMCreated()"));
|
2015-03-26 09:55:30 +03:00
|
|
|
}
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
|
|
|
void
|
2015-01-09 04:30:07 +03:00
|
|
|
CDMProxy::CreateSession(uint32_t aCreateSessionToken,
|
|
|
|
dom::SessionType aSessionType,
|
2014-06-07 00:52:15 +04:00
|
|
|
PromiseId aPromiseId,
|
|
|
|
const nsAString& aInitDataType,
|
2014-08-27 12:46:56 +04:00
|
|
|
nsTArray<uint8_t>& aInitData)
|
2014-06-07 00:52:15 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(mGMPThread);
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsAutoPtr<CreateSessionData> data(new CreateSessionData());
|
|
|
|
data->mSessionType = aSessionType;
|
2015-01-09 04:30:07 +03:00
|
|
|
data->mCreateSessionToken = aCreateSessionToken;
|
2014-07-30 10:53:28 +04:00
|
|
|
data->mPromiseId = aPromiseId;
|
|
|
|
data->mInitDataType = NS_ConvertUTF16toUTF8(aInitDataType);
|
2014-08-27 12:46:56 +04:00
|
|
|
data->mInitData = Move(aInitData);
|
2014-07-30 10:53:28 +04:00
|
|
|
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<CreateSessionData>>(this, &CDMProxy::gmp_CreateSession, data));
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
GMPSessionType
|
|
|
|
ToGMPSessionType(dom::SessionType aSessionType) {
|
|
|
|
switch (aSessionType) {
|
|
|
|
case dom::SessionType::Temporary: return kGMPTemporySession;
|
|
|
|
case dom::SessionType::Persistent: return kGMPPersistentSession;
|
|
|
|
default: return kGMPTemporySession;
|
|
|
|
};
|
|
|
|
};
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::gmp_CreateSession(nsAutoPtr<CreateSessionData> aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
if (!mCDM) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in gmp_CreateSession"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
2015-01-09 04:30:07 +03:00
|
|
|
mCDM->CreateSession(aData->mCreateSessionToken,
|
|
|
|
aData->mPromiseId,
|
2014-07-30 10:53:28 +04:00
|
|
|
aData->mInitDataType,
|
|
|
|
aData->mInitData,
|
|
|
|
ToGMPSessionType(aData->mSessionType));
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::LoadSession(PromiseId aPromiseId,
|
|
|
|
const nsAString& aSessionId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(mGMPThread);
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsAutoPtr<SessionOpData> data(new SessionOpData());
|
|
|
|
data->mPromiseId = aPromiseId;
|
|
|
|
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_LoadSession, data));
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::gmp_LoadSession(nsAutoPtr<SessionOpData> aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
if (!mCDM) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in gmp_LoadSession"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mCDM->LoadSession(aData->mPromiseId, aData->mSessionId);
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::SetServerCertificate(PromiseId aPromiseId,
|
2014-08-27 12:46:56 +04:00
|
|
|
nsTArray<uint8_t>& aCert)
|
2014-06-07 00:52:15 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(mGMPThread);
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsAutoPtr<SetServerCertificateData> data;
|
|
|
|
data->mPromiseId = aPromiseId;
|
2014-08-27 12:46:56 +04:00
|
|
|
data->mCert = Move(aCert);
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<SetServerCertificateData>>(this, &CDMProxy::gmp_SetServerCertificate, data));
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::gmp_SetServerCertificate(nsAutoPtr<SetServerCertificateData> aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
if (!mCDM) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in gmp_SetServerCertificate"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mCDM->SetServerCertificate(aData->mPromiseId, aData->mCert);
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::UpdateSession(const nsAString& aSessionId,
|
|
|
|
PromiseId aPromiseId,
|
2014-08-27 12:46:56 +04:00
|
|
|
nsTArray<uint8_t>& aResponse)
|
2014-06-07 00:52:15 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(mGMPThread);
|
|
|
|
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsAutoPtr<UpdateSessionData> data(new UpdateSessionData());
|
|
|
|
data->mPromiseId = aPromiseId;
|
|
|
|
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
2014-08-27 12:46:56 +04:00
|
|
|
data->mResponse = Move(aResponse);
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::gmp_UpdateSession(nsAutoPtr<UpdateSessionData> aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
if (!mCDM) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in gmp_UpdateSession"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mCDM->UpdateSession(aData->mPromiseId,
|
|
|
|
aData->mSessionId,
|
|
|
|
aData->mResponse);
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::CloseSession(const nsAString& aSessionId,
|
|
|
|
PromiseId aPromiseId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsAutoPtr<SessionOpData> data(new SessionOpData());
|
|
|
|
data->mPromiseId = aPromiseId;
|
|
|
|
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_CloseSession, data));
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::gmp_CloseSession(nsAutoPtr<SessionOpData> aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
if (!mCDM) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in gmp_CloseSession"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mCDM->CloseSession(aData->mPromiseId, aData->mSessionId);
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::RemoveSession(const nsAString& aSessionId,
|
|
|
|
PromiseId aPromiseId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
nsAutoPtr<SessionOpData> data(new SessionOpData());
|
|
|
|
data->mPromiseId = aPromiseId;
|
|
|
|
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2014-07-30 10:53:28 +04:00
|
|
|
NS_NewRunnableMethodWithArg<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_RemoveSession, data));
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::gmp_RemoveSession(nsAutoPtr<SessionOpData> aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
if (!mCDM) {
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
|
|
NS_LITERAL_CSTRING("Null CDM in gmp_RemoveSession"));
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mCDM->RemoveSession(aData->mPromiseId, aData->mSessionId);
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::Shutdown()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
mKeys.Clear();
|
2014-08-08 06:43:54 +04:00
|
|
|
// Note: This may end up being the last owning reference to the CDMProxy.
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(NS_NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
|
2014-12-11 05:59:37 +03:00
|
|
|
if (mGMPThread) {
|
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
|
|
|
}
|
2014-08-08 06:43:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::gmp_Shutdown()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
2014-08-21 08:10:11 +04:00
|
|
|
|
2015-02-10 13:48:29 +03:00
|
|
|
mShutdownCalled = true;
|
|
|
|
|
2014-08-21 08:10:11 +04:00
|
|
|
// Abort any pending decrypt jobs, to awaken any clients waiting on a job.
|
|
|
|
for (size_t i = 0; i < mDecryptionJobs.Length(); i++) {
|
|
|
|
DecryptJob* job = mDecryptionJobs[i];
|
2015-04-15 03:14:49 +03:00
|
|
|
job->PostResult(GMPAbortedErr);
|
2014-08-21 08:10:11 +04:00
|
|
|
}
|
|
|
|
mDecryptionJobs.Clear();
|
|
|
|
|
2014-08-08 06:43:54 +04:00
|
|
|
if (mCDM) {
|
|
|
|
mCDM->Close();
|
|
|
|
mCDM = nullptr;
|
|
|
|
}
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-03 04:42:50 +03:00
|
|
|
CDMProxy::RejectPromise(PromiseId aId, nsresult aCode,
|
|
|
|
const nsCString& aReason)
|
2014-06-07 00:52:15 +04:00
|
|
|
{
|
|
|
|
if (NS_IsMainThread()) {
|
|
|
|
if (!mKeys.IsNull()) {
|
2015-06-03 04:42:50 +03:00
|
|
|
mKeys->RejectPromise(aId, aCode, aReason);
|
2014-06-07 00:52:15 +04:00
|
|
|
}
|
|
|
|
} else {
|
2015-06-03 04:42:50 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(new RejectPromiseTask(this, aId, aCode,
|
|
|
|
aReason));
|
2014-06-07 00:52:15 +04:00
|
|
|
NS_DispatchToMainThread(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::ResolvePromise(PromiseId aId)
|
|
|
|
{
|
|
|
|
if (NS_IsMainThread()) {
|
|
|
|
if (!mKeys.IsNull()) {
|
|
|
|
mKeys->ResolvePromise(aId);
|
|
|
|
} else {
|
|
|
|
NS_WARNING("CDMProxy unable to resolve promise!");
|
|
|
|
}
|
|
|
|
} else {
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task;
|
2014-06-07 00:52:15 +04:00
|
|
|
task = NS_NewRunnableMethodWithArg<PromiseId>(this,
|
|
|
|
&CDMProxy::ResolvePromise,
|
|
|
|
aId);
|
|
|
|
NS_DispatchToMainThread(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-13 02:53:43 +04:00
|
|
|
const nsCString&
|
|
|
|
CDMProxy::GetNodeId() const
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
2014-10-13 02:53:43 +04:00
|
|
|
return mNodeId;
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-01-09 04:30:07 +03:00
|
|
|
CDMProxy::OnSetSessionId(uint32_t aCreateSessionToken,
|
|
|
|
const nsAString& aSessionId)
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-08-18 01:41:50 +04:00
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
2015-01-09 04:30:07 +03:00
|
|
|
|
|
|
|
nsRefPtr<dom::MediaKeySession> session(mKeys->GetPendingSession(aCreateSessionToken));
|
2015-03-26 09:53:23 +03:00
|
|
|
if (session) {
|
|
|
|
session->SetSessionId(aSessionId);
|
|
|
|
}
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
2014-09-24 02:04:49 +04:00
|
|
|
void
|
|
|
|
CDMProxy::OnResolveLoadSessionPromise(uint32_t aPromiseId, bool aSuccess)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mKeys->OnSessionLoaded(aPromiseId, aSuccess);
|
|
|
|
}
|
|
|
|
|
2015-01-15 01:25:47 +03:00
|
|
|
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;
|
2015-01-26 22:08:00 +03:00
|
|
|
case kGMPIndividualizationRequest: return dom::MediaKeyMessageType::Individualization_request;
|
2015-01-15 01:25:47 +03:00
|
|
|
default: return dom::MediaKeyMessageType::License_request;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::OnSessionMessage(const nsAString& aSessionId,
|
2015-01-15 01:25:47 +03:00
|
|
|
GMPSessionMessageType aMessageType,
|
|
|
|
nsTArray<uint8_t>& aMessage)
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-08-18 01:41:50 +04:00
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
2014-07-30 10:53:28 +04:00
|
|
|
nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
|
|
|
|
if (session) {
|
2015-01-15 01:25:47 +03:00
|
|
|
session->DispatchKeyMessage(ToMediaKeyMessageType(aMessageType), aMessage);
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-15 12:33:18 +04:00
|
|
|
void
|
2015-02-03 11:53:36 +03:00
|
|
|
CDMProxy::OnKeyStatusesChange(const nsAString& aSessionId)
|
2014-10-15 12:33:18 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
|
|
|
|
if (session) {
|
2015-02-03 11:53:36 +03:00
|
|
|
session->DispatchKeyStatusesChange();
|
2014-10-15 12:33:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
|
|
|
CDMProxy::OnExpirationChange(const nsAString& aSessionId,
|
|
|
|
GMPTimestamp aExpiryTime)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
NS_WARNING("CDMProxy::OnExpirationChange() not implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::OnSessionClosed(const nsAString& aSessionId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-12-11 05:59:37 +03:00
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
|
|
|
|
if (session) {
|
|
|
|
session->OnClosed();
|
|
|
|
}
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogToConsole(const nsAString& aMsg)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIConsoleService> console(
|
|
|
|
do_GetService("@mozilla.org/consoleservice;1"));
|
|
|
|
if (!console) {
|
|
|
|
NS_WARNING("Failed to log message to console.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsAutoString msg(aMsg);
|
|
|
|
console->LogStringMessage(msg.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::OnSessionError(const nsAString& aSessionId,
|
|
|
|
nsresult aException,
|
|
|
|
uint32_t aSystemCode,
|
|
|
|
const nsAString& aMsg)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-08-18 01:41:50 +04:00
|
|
|
if (mKeys.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
2014-07-30 10:53:28 +04:00
|
|
|
nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
|
|
|
|
if (session) {
|
|
|
|
session->DispatchKeyError(aSystemCode);
|
|
|
|
}
|
|
|
|
LogToConsole(aMsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::OnRejectPromise(uint32_t aPromiseId,
|
|
|
|
nsresult aDOMException,
|
2015-06-03 04:42:50 +03:00
|
|
|
const nsCString& aMsg)
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2015-06-03 04:42:50 +03:00
|
|
|
RejectPromise(aPromiseId, aDOMException, aMsg);
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
const nsString&
|
|
|
|
CDMProxy::KeySystem() const
|
|
|
|
{
|
|
|
|
return mKeySystem;
|
|
|
|
}
|
|
|
|
|
|
|
|
CDMCaps&
|
|
|
|
CDMProxy::Capabilites() {
|
|
|
|
return mCapabilites;
|
|
|
|
}
|
|
|
|
|
2015-07-03 22:04:04 +03:00
|
|
|
nsRefPtr<CDMProxy::DecryptPromise>
|
|
|
|
CDMProxy::Decrypt(MediaRawData* aSample)
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
2015-07-03 22:04:04 +03:00
|
|
|
nsRefPtr<DecryptJob> job(new DecryptJob(aSample));
|
|
|
|
nsRefPtr<DecryptPromise> promise(job->Ensure());
|
|
|
|
|
2015-03-17 19:29:17 +03:00
|
|
|
nsCOMPtr<nsIRunnable> task(
|
2015-04-15 03:14:49 +03:00
|
|
|
NS_NewRunnableMethodWithArg<nsRefPtr<DecryptJob>>(this, &CDMProxy::gmp_Decrypt, job));
|
2014-07-30 10:53:28 +04:00
|
|
|
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
2015-07-03 22:04:04 +03:00
|
|
|
return promise;
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-15 03:14:49 +03:00
|
|
|
CDMProxy::gmp_Decrypt(nsRefPtr<DecryptJob> aJob)
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
|
|
|
|
|
|
|
if (!mCDM) {
|
2015-04-15 03:14:49 +03:00
|
|
|
aJob->PostResult(GMPAbortedErr);
|
2014-07-30 10:53:28 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aJob->mId = ++mDecryptionJobCount;
|
|
|
|
nsTArray<uint8_t> data;
|
2015-08-06 03:58:35 +03:00
|
|
|
data.AppendElements(aJob->mSample->Data(), aJob->mSample->Size());
|
2015-04-09 14:14:55 +03:00
|
|
|
mCDM->Decrypt(aJob->mId, aJob->mSample->mCrypto, data);
|
2014-07-30 10:53:28 +04:00
|
|
|
mDecryptionJobs.AppendElement(aJob.forget());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::gmp_Decrypted(uint32_t aId,
|
|
|
|
GMPErr aResult,
|
|
|
|
const nsTArray<uint8_t>& aDecryptedData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOnGMPThread());
|
2015-04-15 03:14:49 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool jobIdFound = false;
|
|
|
|
#endif
|
2014-07-30 10:53:28 +04:00
|
|
|
for (size_t i = 0; i < mDecryptionJobs.Length(); i++) {
|
|
|
|
DecryptJob* job = mDecryptionJobs[i];
|
|
|
|
if (job->mId == aId) {
|
2015-04-15 03:14:49 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
jobIdFound = true;
|
|
|
|
#endif
|
|
|
|
job->PostResult(aResult, aDecryptedData);
|
2014-07-30 10:53:28 +04:00
|
|
|
mDecryptionJobs.RemoveElementAt(i);
|
|
|
|
}
|
|
|
|
}
|
2015-04-15 03:14:49 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (!jobIdFound) {
|
|
|
|
NS_WARNING("GMPDecryptorChild returned incorrect job ID");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::DecryptJob::PostResult(GMPErr aResult)
|
|
|
|
{
|
|
|
|
nsTArray<uint8_t> empty;
|
|
|
|
PostResult(aResult, empty);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDMProxy::DecryptJob::PostResult(GMPErr aResult, const nsTArray<uint8_t>& aDecryptedData)
|
|
|
|
{
|
2015-08-06 03:58:35 +03:00
|
|
|
if (aDecryptedData.Length() != mSample->Size()) {
|
2015-04-15 03:14:49 +03:00
|
|
|
NS_WARNING("CDM returned incorrect number of decrypted bytes");
|
|
|
|
}
|
|
|
|
if (GMP_SUCCEEDED(aResult)) {
|
|
|
|
nsAutoPtr<MediaRawDataWriter> writer(mSample->CreateWriter());
|
2015-08-06 03:58:35 +03:00
|
|
|
PodCopy(writer->Data(),
|
2015-04-15 03:14:49 +03:00
|
|
|
aDecryptedData.Elements(),
|
2015-08-06 03:58:35 +03:00
|
|
|
std::min<size_t>(aDecryptedData.Length(), mSample->Size()));
|
2015-04-15 03:14:49 +03:00
|
|
|
} else if (aResult == GMPNoKeyErr) {
|
|
|
|
NS_WARNING("CDM returned GMPNoKeyErr");
|
|
|
|
// We still have the encrypted sample, so we can re-enqueue it to be
|
|
|
|
// decrypted again once the key is usable again.
|
|
|
|
} else {
|
|
|
|
nsAutoCString str("CDM returned decode failure GMPErr=");
|
|
|
|
str.AppendInt(aResult);
|
|
|
|
NS_WARNING(str.get());
|
|
|
|
}
|
2015-07-03 22:04:04 +03:00
|
|
|
mPromise.Resolve(DecryptResult(aResult, mSample), __func__);
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
2015-03-26 12:57:36 +03:00
|
|
|
void
|
|
|
|
CDMProxy::GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId,
|
|
|
|
nsTArray<nsCString>& aSessionIds)
|
|
|
|
{
|
|
|
|
CDMCaps::AutoLock caps(Capabilites());
|
|
|
|
caps.GetSessionIdsForKeyId(aKeyId, aSessionIds);
|
|
|
|
}
|
|
|
|
|
2014-07-30 10:53:28 +04:00
|
|
|
void
|
2014-12-17 04:01:00 +03:00
|
|
|
CDMProxy::Terminated()
|
2014-07-30 10:53:28 +04:00
|
|
|
{
|
2014-12-17 04:01:00 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-12-11 05:59:37 +03:00
|
|
|
NS_WARNING("CDM terminated");
|
2014-12-17 04:01:00 +03:00
|
|
|
if (!mKeys.IsNull()) {
|
|
|
|
mKeys->Terminated();
|
|
|
|
}
|
2014-07-30 10:53:28 +04:00
|
|
|
}
|
|
|
|
|
2014-06-07 00:52:15 +04:00
|
|
|
} // namespace mozilla
|