Bug 1316758-Remove nsContentUtils::LegacyIsCallerChromeOrNativeCode and IsCallerChrome calls from HTMLMediaElement.
MozReview-Commit-ID: 47pOATtfflP
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1097,20 +1097,19 @@ static bool HasSourceChildren(nsIContent
}
return false;
}
NS_IMETHODIMP HTMLMediaElement::Load()
{
LOG(LogLevel::Debug,
("%p Load() hasSrcAttrStream=%d hasSrcAttr=%d hasSourceChildren=%d "
- "handlingInput=%d isCallerChromeOrNative=%d",
+ "handlingInput=%d",
this, !!mSrcAttrStream, HasAttr(kNameSpaceID_None, nsGkAtoms::src),
- HasSourceChildren(this), EventStateManager::IsHandlingUserInput(),
- nsContentUtils::LegacyIsCallerChromeOrNativeCode()));
+ HasSourceChildren(this), EventStateManager::IsHandlingUserInput()));
if (mIsRunningLoadMethod) {
return NS_OK;
}
mIsDoingExplicitLoad = true;
DoLoad();
@@ -1122,18 +1121,17 @@ void HTMLMediaElement::DoLoad()
if (mIsRunningLoadMethod) {
return;
}
// Detect if user has interacted with element so that play will not be
// blocked when initiated by a script. This enables sites to capture user
// intent to play by calling load() in the click handler of a "catalog
// view" of a gallery of videos.
- if (EventStateManager::IsHandlingUserInput() ||
- nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
+ if (EventStateManager::IsHandlingUserInput()) {
mHasUserInteraction = true;
}
SetPlayedOrSeeked(false);
mIsRunningLoadMethod = true;
AbortExistingLoads();
SetPlaybackRate(mDefaultPlaybackRate);
QueueSelectResourceTask();
@@ -1844,17 +1842,17 @@ HTMLMediaElement::Seek(double aTime,
RefPtr<Promise> promise = Promise::Create(global, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
// Detect if user has interacted with element by seeking so that
// play will not be blocked when initiated by a script.
- if (EventStateManager::IsHandlingUserInput() || nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
+ if (EventStateManager::IsHandlingUserInput()) {
mHasUserInteraction = true;
}
StopSuspendingAfterFirstFrame();
if (mSrcStream) {
// do nothing since media streams have an empty Seekable range.
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
@@ -6034,18 +6032,17 @@ HTMLMediaElement::IsSuspendedByAudioChan
bool
HTMLMediaElement::IsAllowedToPlay()
{
// Prevent media element from being auto-started by a script when
// media.autoplay.enabled=false
if (!mHasUserInteraction &&
!IsAutoplayEnabled() &&
- !EventStateManager::IsHandlingUserInput() &&
- !nsContentUtils::IsCallerChrome()) {
+ !EventStateManager::IsHandlingUserInput()) {
#if defined(MOZ_WIDGET_ANDROID)
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIContent*>(this),
NS_LITERAL_STRING("MozAutoplayMediaBlocked"),
false,
false);
#endif
return false;