Граф коммитов

27 Коммитов

Автор SHA1 Сообщение Дата
alwu f9e89ee7ae Bug 1597450 - part1 : store autoplay permission on the WindowContext. r=nika
This patch will do :
- create a sync field `AutoplayPermission` on WindowContext
- update the field whenever site's the autoplay permission changes

The advantage of doing so :
- to help determine the result of the blocking autoplay correctly.

More details :
As the field would be automatically synced between processes, then we can know the correct site's autoplay permission for the whole page even if we're in the different process if the iframe is in different origin after we enable Fission.

Differential Revision: https://phabricator.services.mozilla.com/D74511
2020-05-15 21:18:07 +00:00
alwu 54b8cc7893 Bug 1593843 - part8 : move helper functions out from 'AutoplayPolicy'. r=bryce
Move helper functions out from `AutoplayPolicy`, makes us clearly know which one could really be used to determine the blocking autoplay result. It also give other classes an ability to use those helper functions if they have a need.

Differential Revision: https://phabricator.services.mozilla.com/D52432

--HG--
extra : moz-landing-system : lando
2019-11-25 11:00:13 +00:00
Noemi Erli 23395b20e2 Backed out 13 changesets (bug 1593843) for bustages in Logging.h CLOSED TREE
Backed out changeset b6e3fa6363bd (bug 1593843)
Backed out changeset 3db512256b0d (bug 1593843)
Backed out changeset f67081ea84ee (bug 1593843)
Backed out changeset ad02bb934459 (bug 1593843)
Backed out changeset 1a79176d3f7b (bug 1593843)
Backed out changeset 486c8562b816 (bug 1593843)
Backed out changeset 0d4313c436c5 (bug 1593843)
Backed out changeset 0c7e831d11bf (bug 1593843)
Backed out changeset 02ac8c39f46d (bug 1593843)
Backed out changeset 80895462dddf (bug 1593843)
Backed out changeset 4ab855869725 (bug 1593843)
Backed out changeset 5a24fc933cd6 (bug 1593843)
Backed out changeset f1c50ee60a78 (bug 1593843)
2019-11-23 05:18:17 +02:00
alwu f789ab1d90 Bug 1593843 - part8 : move helper functions out from 'AutoplayPolicy'. r=bryce
Move helper functions out from `AutoplayPolicy`, makes us clearly know which one could really be used to determine the blocking autoplay result. It also give other classes an ability to use those helper functions if they have a need.

Differential Revision: https://phabricator.services.mozilla.com/D52432

--HG--
extra : moz-landing-system : lando
2019-11-22 09:17:35 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
alwu 8632d7588c Bug 1506290 - part1 : implement 'document.autoplayPolicy'. r=baku,cpearce
`document.autoplayPolicy` returns a enum string that can change overtime based on user session activity:

- “allowed” if autoplay is currently allowed.
- “allowed-muted” if muted video autoplay is currently allowed.
- “disallowed” is autoplay is not current allowed.

Differential Revision: https://phabricator.services.mozilla.com/D11543

--HG--
extra : moz-landing-system : lando
2019-01-15 00:13:34 +00:00
alwu 15cbe4a2c3 Bug 1512277 - Add Telemetry to know AudioContext blocking status if we enable blocking autoplay for web audio. r=karlt,Dexter
Differential Revision: https://phabricator.services.mozilla.com/D14118

--HG--
extra : moz-landing-system : lando
2019-01-08 21:52:31 +00:00
alwu 047b607301 Bug 1513039 - part6 : remove AutoplayPermissionManager and AutoplayPermissionRequest. r=cpearce,smaug
Depends on D14330

Differential Revision: https://phabricator.services.mozilla.com/D14331

--HG--
extra : moz-landing-system : lando
2019-01-07 18:35:30 +00:00
Emilio Cobos Álvarez d2ed260822 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Sylvestre Ledru 804b8b8883 Bug 1204606 - Reformat of dom/media r=jya
# skip-blame

Differential Revision: https://phabricator.services.mozilla.com/D12251

--HG--
extra : moz-landing-system : lando
2018-11-19 13:25:37 +00:00
alwu d7a75adbdb Bug 1489278 - part1 : show doorhanger when create AudioContext r=padenot
In the ideal situation, sites should create AudioContext only when sites are going to produce
sound, so we would show doorhanger to ask users whether they want to allow autoplay.

We delay the AudioContext's state transition from `suspended` to `running` until
(1) user click 'Allow' button in doorhanger
(2) user interact with sites, and then AudioContext calls resume() again

Differential Revision: https://phabricator.services.mozilla.com/D5610

--HG--
extra : moz-landing-system : lando
2018-09-13 16:51:07 +00:00
Dale Harvey 59e904f6cd Bug 1476555 - Show notification when autoplay blocked globally. r=cpearce,johannh
MozReview-Commit-ID: EI0GiaoBNqX

--HG--
extra : rebase_source : 0c6fb98047913fc50423532cc4c433c4627c5b06
2018-07-23 16:43:08 +01:00
Chris Pearce ea566d079b Bug 1476456 - Add telemetry to report whether autoplay would be not allowed if autoplay was disabled. r=baku,francois
We'd like to add telemetry to help inform the decision as to how enabling
block autoplay will affect video playback in the wild.

Our data science team would also like some input to help them estimate the
rate at which our shield study would receive pings, and the telemetry
collected here will help them estimate that.

We'd like to collect the following, on a per session basis:
* Count of the number of top level content documents loaded, as denominator for
other stats collected here.
* Count of the number of top level content documents which contained (directly
or in a descendant document) playback of an audible media element.
* Count of the number of top level content documents which contained (directly
or in a descendant document) a muted media element that was paused by the
autoplay policy because it tried to unmute and it wasn't allowed to autoplay
audibly.
* Count of the total number of audible autoplay videos that would have not been
allowed to play if block autoplay was enabled. We'd either prompt for
permission on these videos, or block outright depending on user's settings.
* Count of the total number of audible autoplay videos that would have been
allowed to play if block autoplay was enabled.

MozReview-Commit-ID: vHWJPyqHjT

--HG--
extra : rebase_source : e1f22ec83fda8b65d78f1de9f02cf060d424019c
2018-07-18 15:34:04 +12:00
Dale Harvey c9e5e7c554 Bug 1470082 - Change autoplay checkbox to combobox. r=cpearce,flod,johannh
MozReview-Commit-ID: E71TxvgfJlJ

--HG--
extra : rebase_source : 30ca63df77e48a44de4d3e90182440c3937ed32f
2018-06-29 14:14:33 +01:00
Chris Pearce 848dee9a6f Bug 1472580 - Ensure we always get a allow/cancel response to an autoplay media permission request. r=smaug
The front end code can't always guarantee to give us an allow/cancel response
to a permission request. In particular in these cases:
* if we close a tab while showing a doorhanger, or
* if we navigate a tab while showing a doorhanger, or
* if the permission prompt requested in a background tab and never shown.

Handling all of these cases is problematic; we don't get events for all of
these where it's easy and cheap to determine that we should cancel the
permission request.

Canceling the permission request is important in the autoplay-media permission
request case as there's objects waiting on the resolution of the permission
request, and they leak in ASan builds while running chrome tests if the Gecko
size of the permission request doesn't get a notification telling it to stop
waiting.

But we can however rely on the doorhanger code to drop its reference to the
nsIContentPermissionRequest object that we pass to it when the doorhanger goes
away. So we can cancel the permission request in our
nsIContentPermissionRequest's implementation's destructor in order to easily
catch all the above cases.

In order to do that, we need to split AutoplayRequest into two; one part being
the implementation of nsIContentPermissionRequest (AutoplayPermissionRequest),
and the other part being the code to own the PromiseHolder and manage the
permission request (AutoplayPermissionManager).

AutoplayPermissionRequest keeps a weak reference to AutoplayPermissionManager,
so that it can tell the AutoplayPermissionManager to reject the request promise
when it's destroyed.

This fixes the ASan leak for which I got backed out from earlier in this bug,
and also fixes the cases above.

MozReview-Commit-ID: KoVkgIqDleW

--HG--
rename : dom/html/AutoplayRequest.cpp => dom/html/AutoplayPermissionManager.cpp
rename : dom/html/AutoplayRequest.h => dom/html/AutoplayPermissionManager.h
extra : rebase_source : dbca520a93d8c416f6d64c2da027630181bb5910
2018-07-06 21:15:20 +12:00
Chris Pearce ea95e39bc9 Bug 1463919 - Move ask autoplay permission check into AutoplayPolicy. r=jya
MozReview-Commit-ID: KJcVI6gtGXw

--HG--
extra : rebase_source : a2ccd2da32d77708fdeb6ea6361975a7759cb18d
extra : source : 9b1c40f3e61ab351707f2d320ce8f87951e4868e
2018-06-26 14:16:13 +12:00
Chris Pearce bbbdebe6e1 Bug 1463919 - Add AutoplayRequest to encapsulate asking for autoplay permission. r=smaug
Add an implementation of nsIContentPermissionRequest to encapsulate requesting
permission from the user to autoplay audible media.

All documents in the tab request permission using the top level document's
origin, so the AutoplayRequest instance for a tab is stored on the top level
content window of the tab.

AutoplayRequest ensures that there's only a single prompt shown at once.

MozReview-Commit-ID: 2u3aLnEa21z

--HG--
extra : rebase_source : a3db3a1ef87a09442b47ae1b1034b4a0143289fb
extra : source : ae572bf618155a92b136fc5f12c1f8c9ab31f89c
2018-06-22 11:57:24 +12:00
Alastor Wu f59daea779 Bug 1413098 - part1 : add policy to decide whether allow audio context to start. r=padenot
Audio context would be allowed to start if
(1) its document has been activated by user gesture
(2) it's a offline audio context, because it won't directly output sound to audio
    devices

In addition, all resume promises would be pending until audio context has been
allowed and user calls resume() again.

MozReview-Commit-ID: G6RV8dDM6vQ

--HG--
extra : rebase_source : bc1d2ad0594ad1f54c05ade06495918aaee14911
extra : source : 5031770d70fd643230cb4caf6a5106616adaf0fd
2017-12-13 14:05:35 -06:00
Chris Pearce ed8a27f065 Bug 1457048 - Ensure origins with autoplay-media exact permission can autoplay. r=bryce,johannh
Sites which are whitelisted should be allowed to autoplay audible media.
So check whether a HTMLMediaElement's owner doc's principal has an exact
"autoplay-media" permission. This ensures whitelisted origins can autoplay,
but sub-origins of whitelisted origins need their own permission.

MozReview-Commit-ID: 2IO5KIyplEa

--HG--
extra : rebase_source : 4a974aba0533bfbd5e9bb4c4c11d77d17a81db6d
2018-04-30 17:40:50 +12:00
Dorel Luca 48f71154c5 Backed out 2 changesets (bug 1457048) for multiple failures. CLOSED TREE
Backed out changeset a5d71f8bf413 (bug 1457048)
Backed out changeset cd70fc188bc8 (bug 1457048)
2018-05-03 08:39:36 +03:00
Chris Pearce d7eacf6ae5 Bug 1457048 - Ensure origins with autoplay-media exact permission can autoplay. r=bryce,johannh
Sites which are whitelisted should be allowed to autoplay audible media.
So check whether a HTMLMediaElement's owner doc's principal has an exact
"autoplay-media" permission. This ensures whitelisted origins can autoplay,
but sub-origins of whitelisted origins need their own permission.

MozReview-Commit-ID: 2IO5KIyplEa

--HG--
extra : rebase_source : 4d9afdec0caa4a82b53bedfd645f259a5c760e4d
2018-04-30 17:40:50 +12:00
Alastor Wu d7ce5bde2b Bug 1415478 - part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang
Per UX spec, we would allow non-audible media (volume 0, muted, video without audio track)
to autoplay.

MozReview-Commit-ID: HKUyt5Jt4sH

--HG--
extra : rebase_source : 83e53a0035d72984494948f131a5d6e516baa577
2017-11-30 10:50:21 +08:00
Sebastian Hengst 706ac3aea0 Backed out 3 changesets (bug 1415478) for frequently asserting in own test test_autoplay_policy.html at MediaDecoderStateMachine.cpp:989. r=backout
Backed out changeset 6ba103fe1caf (bug 1415478)
Backed out changeset df6721a3584f (bug 1415478)
Backed out changeset 8a802839959b (bug 1415478)

--HG--
extra : rebase_source : be4296b1b36005195897de5544941b58895de661
2017-11-27 19:57:34 +02:00
Alastor Wu a6a6078915 Bug 1415478 - part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang
Per UX spec, we would allow non-audible media (volume 0, muted, video without audio track)
to autoplay.

MozReview-Commit-ID: HKUyt5Jt4sH

--HG--
extra : rebase_source : 97315d90fa46a16289135ac7490bd0dab651d682
2017-11-27 19:20:15 +08:00
dluca 85d0512151 Backed out 3 changesets (bug 1415478) for frequently asserting at dom/media/MediaDecoderStateMachine.cpp:1009 on a CLOSED TREE
Backed out changeset 447d895b350d (bug 1415478)
Backed out changeset d855c032c823 (bug 1415478)
Backed out changeset 6739012c4bdf (bug 1415478)
2017-11-24 18:50:53 +02:00
Alastor Wu 35a99cd8d3 Bug 1415478 - part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang
Per UX spec, we would allow non-audible media (volume 0, muted, video without audio track)
to autoplay.

MozReview-Commit-ID: HKUyt5Jt4sH

--HG--
extra : rebase_source : fa8d1bfd2fb667e974dbe499d7f8215273d4fa10
2017-11-24 11:14:26 +08:00
Alastor Wu 5acb978a09 Bug 1382574 - part1 : create new class AutoplayPolicy to handle autoplay logic. r=jwwang
AutoplayPolicy is used to manage autoplay logic for all kinds of media,
including MediaElement, Web Audio and Web Speech.

MozReview-Commit-ID: R1TxMkarIw

--HG--
extra : rebase_source : 8c608a1d12c8e205391a91f22e1532bc4f2c8f16
2017-11-22 00:33:16 +08:00