Bug 1369548 - HTMLMediaElement::SetMediaKeys should continue working even the decoder is shutting down.
The MediaKeys status inside a HTMLME cannot be reflected correctly if the mSetCDMRequest is disconnected in HTMLME::ShutdownDecoder.
This may happen when a page calls load() or sets new src right after setting MediaKeys to null.
MozReview-Commit-ID: 3BZOmw7BNFO
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1721,17 +1721,17 @@ HTMLMediaElement::OnChannelRedirect(nsIC
MOZ_ASSERT(mChannelLoader);
return mChannelLoader->Redirect(aChannel, aNewChannel, aFlags);
}
void HTMLMediaElement::ShutdownDecoder()
{
RemoveMediaElementFromURITable();
NS_ASSERTION(mDecoder, "Must have decoder to shut down");
- mSetCDMRequest.DisconnectIfExists();
+
mWaitingForKeyListener.DisconnectIfExists();
if (mMediaSource) {
mMediaSource->CompletePendingTransactions();
}
mDecoder->Shutdown();
mDecoder = nullptr;
}
@@ -4069,16 +4069,18 @@ HTMLMediaElement::~HTMLMediaElement()
if (mForceReloadListener) {
mForceReloadListener->Unsubscribe(webProgress);
}
if (mVideoFrameContainer) {
mVideoFrameContainer->ForgetElement();
}
UnregisterActivityObserver();
+
+ mSetCDMRequest.DisconnectIfExists();
if (mDecoder) {
ShutdownDecoder();
}
if (mProgressTimer) {
StopProgress();
}
if (mVideoDecodeSuspendTimer) {
mVideoDecodeSuspendTimer->Cancel();