mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 659285 - Extend media.autoplay.enabled to provide a way to disable untrusted play() invocations. r=cpearce
This commit is contained in:
parent
8bb1e5d240
commit
ae954847c2
@ -105,6 +105,8 @@ static PRLogModuleInfo* gMediaElementEventsLog;
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsContentTypeParser.h"
|
||||
|
||||
#include "mozilla/EventStateManager.h"
|
||||
|
||||
using namespace mozilla::layers;
|
||||
using mozilla::net::nsMediaFragmentURIParser;
|
||||
|
||||
@ -2183,6 +2185,13 @@ HTMLMediaElement::ResetConnectionState()
|
||||
void
|
||||
HTMLMediaElement::Play(ErrorResult& aRv)
|
||||
{
|
||||
// Prevent media element from being auto-started by a script when
|
||||
// media.autoplay.enabled=false
|
||||
if (!IsAutoplayEnabled() && !EventStateManager::IsHandlingUserInput() && !nsContentUtils::IsCallerChrome()) {
|
||||
LOG(PR_LOG_WARN, ("%p Blocked attempt to autoplay media.", this));
|
||||
return;
|
||||
}
|
||||
|
||||
StopSuspendingAfterFirstFrame();
|
||||
SetPlayedOrSeeked(true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user