From 6fd6ac32c9ed4dcf58453a5d281085157e2edfc6 Mon Sep 17 00:00:00 2001 From: alwu Date: Wed, 25 Sep 2019 02:06:57 +0000 Subject: [PATCH] Bug 1578615 - part2 : make the pref 'media.block-autoplay-until-in-foreground' to a static pref. r=chunmin Differential Revision: https://phabricator.services.mozilla.com/D44745 --HG-- extra : moz-landing-system : lando --- dom/base/nsGlobalWindowOuter.cpp | 7 +++---- mobile/android/app/mobile.js | 1 - modules/libpref/init/StaticPrefList.yaml | 9 +++++++++ modules/libpref/init/all.js | 2 -- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index 189a973ae36c..40ca3d79f0d9 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -7911,10 +7911,9 @@ nsPIDOMWindowOuter::nsPIDOMWindowOuter(uint64_t aWindowID) mModalStateDepth(0), mIsActive(false), mIsBackground(false), - mMediaSuspend( - Preferences::GetBool("media.block-autoplay-until-in-foreground", true) - ? nsISuspendedTypes::SUSPENDED_BLOCK - : nsISuspendedTypes::NONE_SUSPENDED), + mMediaSuspend(StaticPrefs::media_block_autoplay_until_in_foreground() + ? nsISuspendedTypes::SUSPENDED_BLOCK + : nsISuspendedTypes::NONE_SUSPENDED), mAudioVolume(1.0), mDesktopModeViewport(false), mIsRootOuterWindow(false), diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 6694533397b1..553c352d026a 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -788,7 +788,6 @@ pref("identity.sync.tokenserver.uri", "https://token.services.mozilla.com/1.0/sy pref("dom.audiochannel.audioCompeting", true); pref("dom.audiochannel.mediaControl", true); -pref("media.block-autoplay-until-in-foreground", false); // Space separated list of URLS that are allowed to send objects (instead of // only strings) through webchannels. This list is duplicated in browser/app/profile/firefox.js diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index af741b2f3c4c..c8703fe13b80 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -6144,6 +6144,15 @@ value: false mirror: always +- name: media.block-autoplay-until-in-foreground + type: bool +#if !defined(MOZ_WIDGET_ANDROID) + value: true +#else + value: false +#endif + mirror: always + #--------------------------------------------------------------------------- # Prefs starting with "mousewheel." #--------------------------------------------------------------------------- diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 7bb64a0c4176..3f649eff2104 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4575,8 +4575,6 @@ pref("dom.maxHardwareConcurrency", 16); pref("osfile.reset_worker_delay", 30000); #endif -pref("media.block-autoplay-until-in-foreground", true); - // TODO: Bug 1324406: Treat 'data:' documents as unique, opaque origins // If true, data: URIs will be treated as unique opaque origins, hence will use // a NullPrincipal as the security context.