mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1282585 - Ensure content process doesn't crash if CDM crashes before MediaKeys attaches to media element or media element loads. r=jwwang
MozReview-Commit-ID: 2CpiDv6u4RP --HG-- extra : rebase_source : bf0077826135e16667253c212b4897830c452e55
This commit is contained in:
parent
2b4bd7f019
commit
58f2e7cb65
@ -3205,7 +3205,13 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
|
||||
|
||||
#ifdef MOZ_EME
|
||||
if (mMediaKeys) {
|
||||
mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy());
|
||||
if (mMediaKeys->GetCDMProxy()) {
|
||||
mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy());
|
||||
} else {
|
||||
// CDM must have crashed.
|
||||
ShutdownDecoder();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -5496,6 +5502,12 @@ HTMLMediaElement::SetMediaKeys(mozilla::dom::MediaKeys* aMediaKeys,
|
||||
|
||||
// 5.3. If mediaKeys is not null, run the following steps:
|
||||
if (aMediaKeys) {
|
||||
if (!aMediaKeys->GetCDMProxy()) {
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
|
||||
NS_LITERAL_CSTRING("CDM crashed before binding MediaKeys object to HTMLMediaElement"));
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// 5.3.1 Associate the CDM instance represented by mediaKeys with the
|
||||
// media element for decrypting media data.
|
||||
if (NS_FAILED(aMediaKeys->Bind(this))) {
|
||||
|
@ -1713,6 +1713,7 @@ void
|
||||
MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aProxy);
|
||||
|
||||
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user