Bug 1520088 - part5 - add pref to control whether blacklist can override the default setting. r=cpearce
authorAlastor Wu <alwu@mozilla.com>
Wed, 16 Jan 2019 03:57:11 +0000
changeset 454150 5a384547b8b35e566a1afa2398067c82244091ba
parent 454149 5e0eb1c0074453818e7135ad87a97e4f3b1e674b
child 454151 317bb711eb47b5108a8d779505757e860f33c3cf
push id35387
push useraiakab@mozilla.com
push dateThu, 17 Jan 2019 04:19:37 +0000
treeherdermozilla-central@e3cb5a5ef667 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1520088
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520088 - part5 - add pref to control whether blacklist can override the default setting. r=cpearce Differential Revision: https://phabricator.services.mozilla.com/D16640
dom/media/AutoplayPolicy.cpp
modules/libpref/init/StaticPrefList.h
--- a/dom/media/AutoplayPolicy.cpp
+++ b/dom/media/AutoplayPolicy.cpp
@@ -190,17 +190,18 @@ static bool IsAllowedToPlayInternal(cons
   Document* approver = ApproverDocOf(*aElement.OwnerDoc());
   if (IsSiteInAutoplayWhiteList(approver)) {
     AUTOPLAY_LOG(
         "Allow autoplay as document has permanent autoplay permission.");
     return true;
   }
 
   if (DefaultAutoplayBehaviour() == nsIAutoplay::ALLOWED &&
-      !IsSiteInAutoplayBlackList(approver)) {
+      !(IsSiteInAutoplayBlackList(approver) &&
+        StaticPrefs::MediaAutoplayBlackListOverrideDefault())) {
     AUTOPLAY_LOG(
         "Allow autoplay as global autoplay setting is allowing autoplay by "
         "default.");
     return true;
   }
 
   if (!Preferences::GetBool("media.autoplay.enabled.user-gestures-needed",
                             false)) {
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -1599,16 +1599,22 @@ VARCACHE_PREF(
 )
 
 VARCACHE_PREF(
   "media.autoplay.allow-muted",
    MediaAutoplayAllowMuted,
   RelaxedAtomicBool, true
 )
 
+VARCACHE_PREF(
+  "media.autoplay.blackList-override-default",
+   MediaAutoplayBlackListOverrideDefault,
+  RelaxedAtomicBool, true
+)
+
 //---------------------------------------------------------------------------
 // Network prefs
 //---------------------------------------------------------------------------
 
 // Sub-resources HTTP-authentication:
 //   0 - don't allow sub-resources to open HTTP authentication credentials
 //       dialogs
 //   1 - allow sub-resources to open HTTP authentication credentials dialogs,