Backed out 7 changesets (bug 1625615) for multiple failures e.g. /test_windowedhistoryframes.html. CLOSED TREE
Backed out changeset f239d24658c9 (bug 1625615) Backed out changeset acea7c78db20 (bug 1625615) Backed out changeset d709f5a72c35 (bug 1625615) Backed out changeset 4cd231b1f3fb (bug 1625615) Backed out changeset 45942c8dc380 (bug 1625615) Backed out changeset 3f03a8703a8a (bug 1625615) Backed out changeset e9299fc48796 (bug 1625615)
This commit is contained in:
@@ -1537,11 +1537,6 @@ class HTMLMediaElement::AudioChannelAgentCallback final
|
||||
return false;
|
||||
}
|
||||
|
||||
// Media is suspended by the docshell.
|
||||
if (mOwner->ShouldBeSuspendedByInactiveDocShell()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Are we paused
|
||||
if (mOwner->mPaused) {
|
||||
return false;
|
||||
@@ -4223,12 +4218,6 @@ already_AddRefed<Promise> HTMLMediaElement::Play(ErrorResult& aRv) {
|
||||
// play promises.
|
||||
// Note: Promise appended to list of pending promises as needed below.
|
||||
|
||||
if (ShouldBeSuspendedByInactiveDocShell()) {
|
||||
LOG(LogLevel::Debug, ("%p no allow to play by the docShell for now", this));
|
||||
mPendingPlayPromises.AppendElement(promise);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// We may delay starting playback of a media resource for an unvisited tab
|
||||
// until it's going to foreground or being resumed by the play tab icon.
|
||||
if (MediaPlaybackDelayPolicy::ShouldDelayPlayback(this)) {
|
||||
@@ -4319,7 +4308,7 @@ void HTMLMediaElement::PlayInternal(bool aHandlingUserInput) {
|
||||
if (mDecoder->IsEnded()) {
|
||||
SetCurrentTime(0);
|
||||
}
|
||||
if (!mSuspendedByInactiveDocOrDocshell) {
|
||||
if (!mSuspendedForInactiveDocument) {
|
||||
mDecoder->Play();
|
||||
}
|
||||
}
|
||||
@@ -5063,13 +5052,13 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (mSuspendedByInactiveDocOrDocshell) {
|
||||
if (mSuspendedForInactiveDocument) {
|
||||
mDecoder->Suspend();
|
||||
}
|
||||
|
||||
if (!mPaused) {
|
||||
SetPlayedOrSeeked(true);
|
||||
if (!mSuspendedByInactiveDocOrDocshell) {
|
||||
if (!mSuspendedForInactiveDocument) {
|
||||
mDecoder->Play();
|
||||
}
|
||||
}
|
||||
@@ -5085,7 +5074,7 @@ void HTMLMediaElement::UpdateSrcMediaStreamPlaying(uint32_t aFlags) {
|
||||
}
|
||||
|
||||
bool shouldPlay = !(aFlags & REMOVING_SRC_STREAM) && !mPaused &&
|
||||
!mSuspendedByInactiveDocOrDocshell;
|
||||
!mSuspendedForInactiveDocument;
|
||||
if (shouldPlay == mSrcStreamIsPlaying) {
|
||||
return;
|
||||
}
|
||||
@@ -5959,7 +5948,7 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState) {
|
||||
if (oldState < HAVE_FUTURE_DATA && mReadyState >= HAVE_FUTURE_DATA) {
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("canplay"));
|
||||
if (!mPaused) {
|
||||
if (mDecoder && !mSuspendedByInactiveDocOrDocshell) {
|
||||
if (mDecoder && !mSuspendedForInactiveDocument) {
|
||||
MOZ_ASSERT(AutoplayPolicy::IsAllowedToPlay(*this));
|
||||
mDecoder->Play();
|
||||
}
|
||||
@@ -6034,7 +6023,7 @@ bool HTMLMediaElement::CanActivateAutoplay() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mSuspendedByInactiveDocOrDocshell) {
|
||||
if (mSuspendedForInactiveDocument) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6044,11 +6033,6 @@ bool HTMLMediaElement::CanActivateAutoplay() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ShouldBeSuspendedByInactiveDocShell()) {
|
||||
LOG(LogLevel::Debug, ("%p prohibiting autoplay by the docShell", this));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MediaPlaybackDelayPolicy::ShouldDelayPlayback(this)) {
|
||||
CreateResumeDelayedMediaPlaybackAgentIfNeeded();
|
||||
LOG(LogLevel::Debug, ("%p delay playing from autoplay", this));
|
||||
@@ -6083,7 +6067,7 @@ void HTMLMediaElement::CheckAutoplayDataReady() {
|
||||
if (mCurrentPlayRangeStart == -1.0) {
|
||||
mCurrentPlayRangeStart = CurrentTime();
|
||||
}
|
||||
MOZ_ASSERT(!mSuspendedByInactiveDocOrDocshell);
|
||||
MOZ_ASSERT(!mSuspendedForInactiveDocument);
|
||||
mDecoder->Play();
|
||||
} else if (mSrcStream) {
|
||||
SetPlayedOrSeeked(true);
|
||||
@@ -6382,11 +6366,11 @@ void HTMLMediaElement::UpdateMediaSize(const nsIntSize& aSize) {
|
||||
void HTMLMediaElement::SuspendOrResumeElement(bool aSuspendElement) {
|
||||
LOG(LogLevel::Debug, ("%p SuspendOrResumeElement(suspend=%d) hidden=%d", this,
|
||||
aSuspendElement, OwnerDoc()->Hidden()));
|
||||
if (aSuspendElement == mSuspendedByInactiveDocOrDocshell) {
|
||||
if (aSuspendElement == mSuspendedForInactiveDocument) {
|
||||
return;
|
||||
}
|
||||
|
||||
mSuspendedByInactiveDocOrDocshell = aSuspendElement;
|
||||
mSuspendedForInactiveDocument = aSuspendElement;
|
||||
UpdateSrcMediaStreamPlaying();
|
||||
UpdateAudioChannelPlayingState();
|
||||
|
||||
@@ -6435,19 +6419,12 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aSuspendElement) {
|
||||
!AutoplayPolicy::IsAllowedToPlay(*this)) {
|
||||
MaybeNotifyAutoplayBlocked();
|
||||
}
|
||||
// If we stopped listening to the event when we suspended media element,
|
||||
// then we should restart to listen to the event if we haven't done so yet.
|
||||
if (mMediaControlEventListener &&
|
||||
!mMediaControlEventListener->IsStarted()) {
|
||||
if (mMediaControlEventListener) {
|
||||
MOZ_ASSERT(!mMediaControlEventListener->IsStarted(),
|
||||
"We didn't stop listening event when we were in bfcache?");
|
||||
StartListeningMediaControlEventIfNeeded();
|
||||
}
|
||||
}
|
||||
if (StaticPrefs::media_testing_only_events()) {
|
||||
auto dispatcher = MakeRefPtr<AsyncEventDispatcher>(
|
||||
this, NS_LITERAL_STRING("MozMediaSuspendChanged"), CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
dispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
||||
bool HTMLMediaElement::IsBeingDestroyed() {
|
||||
@@ -6459,16 +6436,6 @@ bool HTMLMediaElement::IsBeingDestroyed() {
|
||||
return isBeingDestroyed;
|
||||
}
|
||||
|
||||
bool HTMLMediaElement::ShouldBeSuspendedByInactiveDocShell() const {
|
||||
nsIDocShell* docShell = OwnerDoc()->GetDocShell();
|
||||
if (!docShell) {
|
||||
return false;
|
||||
}
|
||||
bool isDocShellActive = false;
|
||||
docShell->GetIsActive(&isDocShellActive);
|
||||
return !isDocShellActive && docShell->GetSuspendMediaWhenInactive();
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() {
|
||||
bool visible = !IsHidden();
|
||||
if (visible) {
|
||||
@@ -6483,11 +6450,7 @@ void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() {
|
||||
NotifyDecoderActivityChanges();
|
||||
}
|
||||
|
||||
// We would suspend media when the document is inactive, or its docshell has
|
||||
// been set to hidden and explicitly wants to suspend media. In those cases,
|
||||
// the media would be not visible and we don't want them to continue playing.
|
||||
bool shouldSuspend = !IsActive() || ShouldBeSuspendedByInactiveDocShell();
|
||||
SuspendOrResumeElement(shouldSuspend);
|
||||
SuspendOrResumeElement(!IsActive());
|
||||
|
||||
// If the owning document has become inactive we should shutdown the CDM.
|
||||
if (!OwnerDoc()->IsCurrentActiveDocument() && mMediaKeys) {
|
||||
@@ -7199,10 +7162,6 @@ bool HTMLMediaElement::ComputedMuted() const {
|
||||
return (mMuted & MUTED_BY_AUDIO_CHANNEL);
|
||||
}
|
||||
|
||||
bool HTMLMediaElement::IsSuspendedByInactiveDocOrDocShell() const {
|
||||
return mSuspendedByInactiveDocOrDocshell;
|
||||
}
|
||||
|
||||
bool HTMLMediaElement::IsCurrentlyPlaying() const {
|
||||
// We have playable data, but we still need to check whether data is "real"
|
||||
// current data.
|
||||
|
||||
Reference in New Issue
Block a user