Bug 1799535 - Clean-up autoplay prefs. r=alwu,geckoview-reviewers,calu

Differential Revision: https://phabricator.services.mozilla.com/D161518
This commit is contained in:
Emilio Cobos Álvarez 2022-11-07 23:13:44 +00:00
Родитель 1388a6da46
Коммит 75f4e85d71
7 изменённых файлов: 25 добавлений и 25 удалений

Просмотреть файл

@ -1791,9 +1791,6 @@ pref("media.gmp.trial-create.enabled", true);
pref("media.gmp-gmpopenh264.visible", true);
pref("media.gmp-gmpopenh264.enabled", true);
// Set Firefox to block autoplay, asking for permission by default.
pref("media.autoplay.default", 1); // 0=Allowed, 1=Blocked, 5=All Blocked
// Block WebAudio from playing automatically.
pref("media.autoplay.block-webaudio", true);

Просмотреть файл

@ -16426,9 +16426,7 @@ void Document::ResetUserInteractionTimer() {
}
bool Document::IsExtensionPage() const {
return Preferences::GetBool("media.autoplay.allow-extension-background-pages",
true) &&
BasePrincipal::Cast(NodePrincipal())->AddonPolicy();
return BasePrincipal::Cast(NodePrincipal())->AddonPolicy();
}
void Document::AddResizeObserver(ResizeObserver& aObserver) {

Просмотреть файл

@ -15,7 +15,6 @@
#include "mozilla/dom/WindowContext.h"
#include "mozilla/Logging.h"
#include "mozilla/MediaManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/Components.h"
#include "mozilla/StaticPrefs_media.h"
#include "nsContentUtils.h"
@ -99,7 +98,8 @@ static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {
return true;
}
if (currentDoc->IsExtensionPage()) {
if (StaticPrefs::media_autoplay_allow_extension_background_pages() &&
currentDoc->IsExtensionPage()) {
AUTOPLAY_LOG("Allow autoplay as in extension document.");
return true;
}
@ -108,8 +108,7 @@ static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {
}
static uint32_t DefaultAutoplayBehaviour() {
int prefValue =
Preferences::GetInt("media.autoplay.default", nsIAutoplay::ALLOWED);
int32_t prefValue = StaticPrefs::media_autoplay_default();
if (prefValue == nsIAutoplay::ALLOWED) {
return nsIAutoplay::ALLOWED;
}
@ -141,7 +140,7 @@ static bool IsAudioContextAllowedToPlay(const AudioContext& aContext) {
}
static bool IsEnableBlockingWebAudioByUserGesturePolicy() {
return Preferences::GetBool("media.autoplay.block-webaudio", false) &&
return StaticPrefs::media_autoplay_block_webaudio() &&
StaticPrefs::media_autoplay_blocking_policy() ==
sPOLICY_STICKY_ACTIVATION;
}

Просмотреть файл

@ -29,7 +29,7 @@ https://trac.torproject.org/projects/tor/ticket/15757
["privacy.resistFingerprinting", true],
["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", MS_PER_TIME_ATOM * 1000],
["privacy.resistFingerprinting.reduceTimerPrecision.jitter", false],
// We use 240p as the target resoultion since 480p is greater than every video
// We use 240p as the target resolution since 480p is greater than every video
// source in our test suite, so we need to use 240p here for allowing us to
// test dropped rate here.
["privacy.resistFingerprinting.target_video_res", 240]

Просмотреть файл

@ -410,9 +410,6 @@ pref("media.video-queue.send-to-compositor-size", 1);
pref("media.mediadrm-widevinecdm.visible", true);
// Set Fennec to block autoplay by default.
pref("media.autoplay.default", 1); // 0=Allowed, 1=Blocked
// Enable WebSpeech speech synthesis
pref("media.webspeech.synth.enabled", true);

Просмотреть файл

@ -9112,6 +9112,25 @@
value: 0
mirror: always
# Whether to allow autoplay on extension background pages.
- name: media.autoplay.allow-extension-background-pages
type: bool
value: true
mirror: always
# Block autoplay, asking for permission by default.
# 0=Allowed, 1=Blocked, 5=All Blocked
- name: media.autoplay.default
type: int32_t
value: 1
mirror: always
# Wether to block autoplay for webaudio
- name: media.autoplay.block-webaudio
type: bool
value: false
mirror: always
# File-backed MediaCache size.
- name: media.cache_size
type: RelaxedAtomicUint32

Просмотреть файл

@ -420,16 +420,6 @@ pref("media.recorder.audio_node.enabled", false);
// to keep up under load. Useful for tests but beware of memory consumption!
pref("media.recorder.video.frame_drops", true);
// Whether to autostart a media element with an |autoplay| attribute.
// ALLOWED=0, BLOCKED=1, defined in dom/media/Autoplay.idl
pref("media.autoplay.default", 0);
// By default, don't block WebAudio from playing automatically.
pref("media.autoplay.block-webaudio", false);
// By default, don't block the media from extension background script.
pref("media.autoplay.allow-extension-background-pages", true);
// The default number of decoded video frames that are enqueued in
// MediaDecoderReader's mVideoQueue.
pref("media.video-queue.default-size", 10);