Bug 1593739 - Shut down the watch manager during Unlink to prevent future notify tasks. r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D51906

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-11-15 09:39:15 +00:00
parent 2990929969
commit a91244fa43

View File

@ -1692,6 +1692,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement,
nsGenericHTMLElement)
tmp->mWatchManager.Shutdown();
tmp->RemoveMutationObserver(tmp);
if (tmp->mSrcStream) {
// Need to EndMediaStreamPlayback to clear mSrcStream and make sure
@ -5074,17 +5075,20 @@ void HTMLMediaElement::EndSrcMediaStreamPlayback() {
mFirstFrameListener = nullptr;
if (mMediaStreamRenderer) {
mWatchManager.Unwatch(mPaused,
&HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Unwatch(mReadyState,
&HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Unwatch(mSrcStreamPlaybackEnded,
&HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Unwatch(
mSrcStreamPlaybackEnded,
&HTMLMediaElement::UpdateSrcStreamReportPlaybackEnded);
mWatchManager.Unwatch(mMediaStreamRenderer->CurrentGraphTime(),
&HTMLMediaElement::UpdateSrcStreamTime);
if (!mWatchManager.IsShutdown()) {
mWatchManager.Unwatch(
mPaused, &HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Unwatch(
mReadyState, &HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Unwatch(
mSrcStreamPlaybackEnded,
&HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Unwatch(
mSrcStreamPlaybackEnded,
&HTMLMediaElement::UpdateSrcStreamReportPlaybackEnded);
mWatchManager.Unwatch(mMediaStreamRenderer->CurrentGraphTime(),
&HTMLMediaElement::UpdateSrcStreamTime);
}
mMediaStreamRenderer->Shutdown();
mMediaStreamRenderer = nullptr;
}