Bug 1470346 - Gesture activate all documents in tab, even across origins, upon user interaction. r=smaug

Sometimes when video is playing, a preroll ad plays, and that may be in a cross
origin iframe. If autoplay media is disabled, we require a user gesture in a
document before playback in that document is permitted, and we require each
origin to be gesture activated separately. So in the cross origin preroll video
add case, then the user will have to click once to unblock playback for the
cross origin ad, and then once the preroll ad finishes, the user will have to
click again to activate playback of the same origin content video.

This is a bad user experience.

So we should instead make gesture activation propagate up the doc tree
irrespective of crossing origins.  This way, when the user clicks to activate,
all documents in that tab are also also effectively gesture activated, and so
can autoplay.

MozReview-Commit-ID: 1HZQ5zkubR
This commit is contained in:
Chris Pearce
2018-06-22 11:52:20 +12:00
parent 3393874725
commit fd68a38fe1
8 changed files with 60 additions and 135 deletions

View File

@@ -1996,7 +1996,7 @@ HTMLMediaElement::Load()
IsAllowedToPlay(),
OwnerDoc(),
DocumentOrigin(OwnerDoc()).get(),
OwnerDoc() ? OwnerDoc()->HasBeenUserActivated() : 0,
OwnerDoc() ? OwnerDoc()->HasBeenUserGestureActivated() : 0,
mMuted,
mVolume));