Bug 1317167 - only need to do the untrust JS checking in play(). r=jwwang
The first checking condition in the IsAllowedPlay() is used to prevent the play() operation is called by untrusted JS when media.autoplay.enabled=false. Therefore, we don't need to check that in CanActivateAutoplay(). MozReview-Commit-ID: 6yqoG8ISyra
This commit is contained in:
@@ -4986,7 +4986,7 @@ bool HTMLMediaElement::CanActivateAutoplay()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsAllowedToPlay()) {
|
||||
if (!IsAllowedToPlayByAudioChannel()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6051,6 +6051,12 @@ HTMLMediaElement::IsAllowedToPlay()
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsAllowedToPlayByAudioChannel();
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLMediaElement::IsAllowedToPlayByAudioChannel()
|
||||
{
|
||||
// The media element has already been paused or blocked, so it can't start
|
||||
// playback again by script or user's intend until resuming by audio channel.
|
||||
if (mAudioChannelSuspended == nsISuspendedTypes::SUSPENDED_PAUSE ||
|
||||
|
||||
Reference in New Issue
Block a user