mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 08:27:31 +09:00
Issue #26 - Part 2b: Stub out GMPDecryptorProxy functions.
If EME isn't built, these functions would have no use and the callback structures are unavailable. Stubbing these out will still allow the callers to work unchanged, but in effect simply always return without dispatching a promised task. This fixes the dependency issue from part 2a.
This commit is contained in:
parent
429f908af1
commit
995d48aa96
2 changed files with 35 additions and 1 deletions
|
|
@ -43,11 +43,13 @@ GMPDecryptorParent::~GMPDecryptorParent()
|
|||
bool
|
||||
GMPDecryptorParent::RecvSetDecryptorId(const uint32_t& aId)
|
||||
{
|
||||
#ifdef MOZ_EME
|
||||
if (!mIsOpen) {
|
||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||
return false;
|
||||
}
|
||||
mCallback->SetDecryptorId(aId);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -202,6 +204,7 @@ 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()));
|
||||
|
||||
|
|
@ -210,6 +213,7 @@ GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
|
|||
return false;
|
||||
}
|
||||
mCallback->SetSessionId(aCreateSessionId, aSessionId);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -217,6 +221,7 @@ bool
|
|||
GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
|
||||
const bool& aSuccess)
|
||||
{
|
||||
#ifdef MOZ_EME
|
||||
LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)",
|
||||
this, aPromiseId));
|
||||
|
||||
|
|
@ -225,12 +230,14 @@ GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
|
|||
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));
|
||||
|
||||
|
|
@ -239,6 +246,7 @@ GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
|
|||
return false;
|
||||
}
|
||||
mCallback->ResolvePromise(aPromiseId);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -266,6 +274,7 @@ 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()));
|
||||
|
||||
|
|
@ -274,10 +283,11 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
|
|||
return false;
|
||||
}
|
||||
mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOZ_EME
|
||||
static dom::MediaKeyMessageType
|
||||
ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
|
||||
switch (aMessageType) {
|
||||
|
|
@ -288,12 +298,14 @@ ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
|
|||
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()));
|
||||
|
||||
|
|
@ -302,6 +314,7 @@ GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
|
|||
return false;
|
||||
}
|
||||
mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -309,6 +322,7 @@ bool
|
|||
GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
|
||||
const double& aExpiryTime)
|
||||
{
|
||||
#ifdef MOZ_EME
|
||||
LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
|
||||
this, aSessionId.get(), aExpiryTime));
|
||||
|
||||
|
|
@ -317,12 +331,14 @@ GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
|
|||
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()));
|
||||
|
||||
|
|
@ -331,6 +347,7 @@ GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
|
|||
return false;
|
||||
}
|
||||
mCallback->SessionClosed(aSessionId);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -340,6 +357,7 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
|
|||
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()));
|
||||
|
|
@ -352,9 +370,11 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
|
|||
GMPExToNsresult(aException),
|
||||
aSystemCode,
|
||||
aMessage);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_EME
|
||||
static dom::MediaKeyStatus
|
||||
ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
|
||||
switch (aStatus) {
|
||||
|
|
@ -368,11 +388,13 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
|
|||
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()));
|
||||
|
||||
|
|
@ -392,9 +414,11 @@ GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
|
|||
}
|
||||
mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_EME
|
||||
DecryptStatus
|
||||
ToDecryptStatus(GMPErr aError)
|
||||
{
|
||||
|
|
@ -405,12 +429,14 @@ ToDecryptStatus(GMPErr aError)
|
|||
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));
|
||||
|
||||
|
|
@ -419,6 +445,7 @@ GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
|
|||
return false;
|
||||
}
|
||||
mCallback->Decrypted(aId, ToDecryptStatus(aErr), aBuffer);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue