Bug 1369548 - HTMLMediaElement::SetMediaKeys should continue working even the decoder is shutting down. draft
authorKilik Kuo <kikuo@mozilla.com>
Wed, 15 Nov 2017 12:32:50 +0800
changeset 697999 7bf7936fb98e56fdd346ec93f14f24f240e09d4f
parent 695307 e2f87726b6082db0ae8a0866f65bff6b7062a07c
child 740265 eabaf9e745190abe3770604d3d7289ca51adf69d
push id89167
push userkikuo@mozilla.com
push dateWed, 15 Nov 2017 04:33:17 +0000
bugs1369548
milestone58.0a1
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
dom/html/HTMLMediaElement.cpp
--- 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();