зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513681 - part1 : dispatch 'GloballyAutoplayBlocked' event when site is blocked r=cpearce,smaug
This event is used to notify tab that this site is blocked and we should show the blocking icon for it. Patch2 will handle following details. Differential Revision: https://phabricator.services.mozilla.com/D14794 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
da7650abaa
Коммит
4d16da70e0
|
@ -11738,6 +11738,20 @@ void Document::NotifyUserGestureActivation() {
|
|||
}
|
||||
}
|
||||
|
||||
void Document::MaybeNotifyAutoplayBlocked() {
|
||||
Document* topLevelDoc = GetTopLevelContentDocument();
|
||||
if (!topLevelDoc) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This event is used to notify front-end side that we've blocked autoplay,
|
||||
// so front-end side should show blocking icon as well.
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
|
||||
topLevelDoc, NS_LITERAL_STRING("GloballyAutoplayBlocked"),
|
||||
CanBubble::eYes, ChromeOnlyDispatch::eYes);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
void Document::SetDocTreeHadAudibleMedia() {
|
||||
Document* topLevelDoc = GetTopLevelContentDocument();
|
||||
if (!topLevelDoc) {
|
||||
|
|
|
@ -3485,6 +3485,10 @@ class Document : public nsINode,
|
|||
|
||||
void ReportShadowDOMUsage();
|
||||
|
||||
// When the doc is blocked permanantly, we would dispatch event to notify
|
||||
// front-end side to show blocking icon.
|
||||
void MaybeNotifyAutoplayBlocked();
|
||||
|
||||
// Sets flags for media autoplay telemetry.
|
||||
void SetDocTreeHadAudibleMedia();
|
||||
void SetDocTreeHadPlayRevoked();
|
||||
|
|
|
@ -3697,6 +3697,7 @@ void HTMLMediaElement::DispatchEventsWhenPlayWasNotAllowed() {
|
|||
ChromeOnlyDispatch::eYes);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
#endif
|
||||
OwnerDoc()->MaybeNotifyAutoplayBlocked();
|
||||
}
|
||||
|
||||
void HTMLMediaElement::PlayInternal(bool aHandlingUserInput) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче