Bug 1316758-Remove nsContentUtils::LegacyIsCallerChromeOrNativeCode and IsCallerChrome calls from HTMLMediaElement. r=cpearce

MozReview-Commit-ID: 47pOATtfflP

--HG--
extra : rebase_source : 43123ebd61a2730b3ccdeaccfaf4dfccfb0cbe55
This commit is contained in:
Kilik Kuo 2016-11-18 10:30:00 +08:00
parent 921cf9fc01
commit e883edbbf2

View File

@ -1102,10 +1102,9 @@ NS_IMETHODIMP HTMLMediaElement::Load()
{ {
LOG(LogLevel::Debug, LOG(LogLevel::Debug,
("%p Load() hasSrcAttrStream=%d hasSrcAttr=%d hasSourceChildren=%d " ("%p Load() hasSrcAttrStream=%d hasSrcAttr=%d hasSourceChildren=%d "
"handlingInput=%d isCallerChromeOrNative=%d", "handlingInput=%d",
this, !!mSrcAttrStream, HasAttr(kNameSpaceID_None, nsGkAtoms::src), this, !!mSrcAttrStream, HasAttr(kNameSpaceID_None, nsGkAtoms::src),
HasSourceChildren(this), EventStateManager::IsHandlingUserInput(), HasSourceChildren(this), EventStateManager::IsHandlingUserInput()));
nsContentUtils::LegacyIsCallerChromeOrNativeCode()));
if (mIsRunningLoadMethod) { if (mIsRunningLoadMethod) {
return NS_OK; return NS_OK;
@ -1127,8 +1126,7 @@ void HTMLMediaElement::DoLoad()
// blocked when initiated by a script. This enables sites to capture user // 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 // intent to play by calling load() in the click handler of a "catalog
// view" of a gallery of videos. // view" of a gallery of videos.
if (EventStateManager::IsHandlingUserInput() || if (EventStateManager::IsHandlingUserInput()) {
nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
mHasUserInteraction = true; mHasUserInteraction = true;
} }
@ -1849,7 +1847,7 @@ HTMLMediaElement::Seek(double aTime,
// Detect if user has interacted with element by seeking so that // Detect if user has interacted with element by seeking so that
// play will not be blocked when initiated by a script. // play will not be blocked when initiated by a script.
if (EventStateManager::IsHandlingUserInput() || nsContentUtils::LegacyIsCallerChromeOrNativeCode()) { if (EventStateManager::IsHandlingUserInput()) {
mHasUserInteraction = true; mHasUserInteraction = true;
} }
@ -6039,8 +6037,7 @@ HTMLMediaElement::IsAllowedToPlay()
// media.autoplay.enabled=false // media.autoplay.enabled=false
if (!mHasUserInteraction && if (!mHasUserInteraction &&
!IsAutoplayEnabled() && !IsAutoplayEnabled() &&
!EventStateManager::IsHandlingUserInput() && !EventStateManager::IsHandlingUserInput()) {
!nsContentUtils::IsCallerChrome()) {
#if defined(MOZ_WIDGET_ANDROID) #if defined(MOZ_WIDGET_ANDROID)
nsContentUtils::DispatchTrustedEvent(OwnerDoc(), nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIContent*>(this), static_cast<nsIContent*>(this),