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 514135 5a384547b8b3
parent 514134 5e0eb1c00744
child 514136 317bb711eb47
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [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,