Bug 1082203 - Route CDMCallbackProxy::Terminated to MediaKeys::Terminated so MediaKeys has a chance to handle CDM crashes and close sessions if necessary. r=cpearce

This commit is contained in:
JW Wang
2014-12-16 20:01:00 -05:00
parent 42fbdad8f7
commit 420269f21d
6 changed files with 59 additions and 8 deletions

View File

@@ -2991,6 +2991,14 @@ void HTMLMediaElement::Error(uint16_t aErrorCode)
aErrorCode == nsIDOMMediaError::MEDIA_ERR_NETWORK ||
aErrorCode == nsIDOMMediaError::MEDIA_ERR_ABORTED,
"Only use nsIDOMMediaError codes!");
// Since we have multiple paths calling into DecodeError, e.g.
// MediaKeys::Terminated and EMEH264Decoder::Error. We should take the 1st
// one only in order not to fire multiple 'error' events.
if (mError) {
return;
}
mError = new MediaError(this, aErrorCode);
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {