Bug 1513039 - part10 : remove nsIAutoplay.PROMPT r=daleharvey,cpearce
authoralwu <alwu@mozilla.com>
Mon, 07 Jan 2019 18:41:03 +0000
changeset 512762 2e48b6769911
parent 512761 cc8a4fd6fda0
child 512763 df38df5ce11e
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)
reviewersdaleharvey, cpearce
bugs1513039
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 1513039 - part10 : remove nsIAutoplay.PROMPT r=daleharvey,cpearce Depends on D14334 Differential Revision: https://phabricator.services.mozilla.com/D14335
browser/app/profile/firefox.js
dom/media/AutoplayPolicy.cpp
dom/media/nsIAutoplay.idl
mobile/android/app/mobile.js
modules/libpref/init/all.js
toolkit/content/tests/browser/browser_autoplay_policy_touchScroll.js
toolkit/content/tests/browser/browser_autoplay_policy_webRTC_permission.js
toolkit/content/tests/browser/browser_autoplay_videoDocument.js
toolkit/content/tests/browser/browser_block_autoplay_media.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1463,21 +1463,21 @@ pref("media.gmp-widevinecdm.enabled", tr
 #endif
 
 #ifdef NIGHTLY_BUILD
 // Switch block autoplay logic to v2, and enable UI.
 pref("media.autoplay.enabled.user-gestures-needed", true);
 // Allow asking for permission to autoplay to appear in UI.
 pref("media.autoplay.ask-permission", false);
 // Set Firefox to block autoplay, asking for permission by default.
-pref("media.autoplay.default", 1); // 0=Allowed, 1=Blocked, 2=Prompt
+pref("media.autoplay.default", 1); // 0=Allowed, 1=Blocked
 // Block WebAudio from playing automatically.
 pref("media.autoplay.block-webaudio", true);
 #else
-pref("media.autoplay.default", 0); // 0=Allowed, 1=Blocked, 2=Prompt
+pref("media.autoplay.default", 0); // 0=Allowed, 1=Blocked
 pref("media.autoplay.enabled.user-gestures-needed", false);
 pref("media.autoplay.ask-permission", false);
 pref("media.autoplay.block-webaudio", false);
 #endif
 
 
 // Play with different values of the decay time and get telemetry,
 // 0 means to randomize (and persist) the experiment value in users' profiles,
--- a/dom/media/AutoplayPolicy.cpp
+++ b/dom/media/AutoplayPolicy.cpp
@@ -109,19 +109,19 @@ static bool IsWindowAllowedToPlay(nsPIDO
   }
 
   return false;
 }
 
 static uint32_t DefaultAutoplayBehaviour() {
   int prefValue =
       Preferences::GetInt("media.autoplay.default", nsIAutoplay::ALLOWED);
-  if (prefValue < nsIAutoplay::ALLOWED || prefValue > nsIAutoplay::PROMPT) {
-    // Invalid pref values are just converted to ALLOWED.
-    return nsIAutoplay::ALLOWED;
+  if (prefValue < nsIAutoplay::ALLOWED || prefValue > nsIAutoplay::BLOCKED) {
+    // Invalid pref values are just converted to BLOCKED.
+    return nsIAutoplay::BLOCKED;
   }
   return prefValue;
 }
 
 static bool IsMediaElementAllowedToPlay(const HTMLMediaElement& aElement) {
   const bool isAllowedMuted =
       Preferences::GetBool("media.autoplay.allow-muted", true);
   if ((aElement.Volume() == 0.0 || aElement.Muted()) && isAllowedMuted) {
--- a/dom/media/nsIAutoplay.idl
+++ b/dom/media/nsIAutoplay.idl
@@ -8,10 +8,9 @@
 [scriptable, uuid(048a24f6-c4d6-47bc-bea2-f6038d1db80a)]
 interface nsIAutoplay : nsISupports
 {
   /*
    * Possible values for the "media.autoplay.default" preference.
    */
   const uint32_t ALLOWED = 0;
   const uint32_t BLOCKED = 1;
-  const uint32_t PROMPT  = 2;
 };
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -582,19 +582,19 @@ pref("media.mediasource.enabled", true);
 pref("media.mediadrm-widevinecdm.visible", true);
 
 #ifdef NIGHTLY_BUILD
 // Switch block autoplay logic to v2.
 pref("media.autoplay.enabled.user-gestures-needed", true);
 // UI/prompting for permission isn't implemented for Fennec, so disable.
 pref("media.autoplay.ask-permission", false);
 // Set Fennec to block autoplay by default.
-pref("media.autoplay.default", 1); // 0=Allowed, 1=Blocked, 2=Prompt
+pref("media.autoplay.default", 1); // 0=Allowed, 1=Blocked
 #else
-pref("media.autoplay.default", 0); // 0=Allowed, 1=Blocked, 2=Prompt
+pref("media.autoplay.default", 0); // 0=Allowed, 1=Blocked
 pref("media.autoplay.enabled.user-gestures-needed", false);
 pref("media.autoplay.ask-permission", false);
 #endif
 
 // Enable WebSpeech speech synthesis
 pref("media.webspeech.synth.enabled", true);
 
 // optimize images memory usage
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -586,17 +586,17 @@ pref("media.encoder.webm.enabled", true)
 // Whether to allow recording of AudioNodes with MediaRecorder
 pref("media.recorder.audio_node.enabled", false);
 
 // Whether MediaRecorder's video encoder should allow dropping frames in order
 // 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, PROMPT=2, defined in dom/media/Autoplay.idl
+// 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 muted media from playing automatically.
 pref("media.autoplay.allow-muted", true);
 
--- a/toolkit/content/tests/browser/browser_autoplay_policy_touchScroll.js
+++ b/toolkit/content/tests/browser/browser_autoplay_policy_touchScroll.js
@@ -48,19 +48,18 @@ async function synthesizeTouchScroll(tar
   await BrowserTestUtils.synthesizeTouch(target, offset / 2, offset / 2,
                                          { type: "touchmove" }, browser);
   await BrowserTestUtils.synthesizeTouch(target, offset, offset,
                                          { type: "touchend" }, browser);
 }
 
 add_task(async function setup_test_preference() {
   return SpecialPowers.pushPrefEnv({"set": [
-    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.PROMPT],
+    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
     ["media.autoplay.enabled.user-gestures-needed", true],
-    ["media.autoplay.ask-permission", true],
   ]});
 });
 
 add_task(async function testTouchScroll() {
   await BrowserTestUtils.withNewTab({
     gBrowser,
     url: PAGE,
   }, async (browser) => {
--- a/toolkit/content/tests/browser/browser_autoplay_policy_webRTC_permission.js
+++ b/toolkit/content/tests/browser/browser_autoplay_policy_webRTC_permission.js
@@ -4,17 +4,17 @@
  */
 "use strict";
 
 ChromeUtils.import("resource:///modules/SitePermissions.jsm", this);
 const VIDEO_PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_empty.html";
 
 add_task(() => {
   return SpecialPowers.pushPrefEnv({"set": [
-    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.PROMPT],
+    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
     ["media.autoplay.enabled.user-gestures-needed", true],
     ["media.autoplay.block-event.enabled", true],
   ]});
 });
 
 async function testAutoplayWebRTCPermission(args) {
   info(`- Starting ${args.name} -`);
   await BrowserTestUtils.withNewTab({
--- a/toolkit/content/tests/browser/browser_autoplay_videoDocument.js
+++ b/toolkit/content/tests/browser/browser_autoplay_videoDocument.js
@@ -1,15 +1,15 @@
 "use strict";
 
 const PAGE = "https://example.com/browser/toolkit/content/tests/browser/audio.ogg";
 
 function setup_test_preference() {
   return SpecialPowers.pushPrefEnv({"set": [
-    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.PROMPT],
+    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
     ["media.autoplay.enabled.user-gestures-needed", true],
     ["media.autoplay.ask-permission", true],
   ]});
 }
 
 function checkIsVideoDocumentAutoplay(browser) {
   return ContentTask.spawn(browser, null, async () => {
     const video = content.document.getElementsByTagName("video")[0];
--- a/toolkit/content/tests/browser/browser_block_autoplay_media.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_media.js
@@ -67,29 +67,28 @@ add_task(async function block_autoplay_m
   await waitForTabPlayingEvent(tab1, true);
   await check_audio_suspended(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED);
 
   info("- should still block media from tab2 -");
   await waitForTabPlayingEvent(tab2, false);
   await check_audio_suspended(tab2.linkedBrowser, SuspendedType.SUSPENDED_BLOCK);
 
 
-  // Test 4: Disable autoplay, enable asking for permission, and verify
-  // that when a tab is opened in the background and has had its playback
-  // start delayed, resuming via the audio tab indicator overrides the
-  // autoplay blocking logic.
+  // Test 4: Disable autoplay and verify that when a tab is opened in the
+  // background and has had its playback start delayed, resuming via the audio
+  // tab indicator overrides the autoplay blocking logic.
   //
   // Clicking "play" on the audio tab indicator should always start playback
   // in that tab, even if it's in an autoplay-blocked origin.
   //
   // Also test that that this block-autoplay logic override doesn't survive
   // a new document being loaded into the tab; the new document should have
   // to satisfy the autoplay requirements on its own.
   await SpecialPowers.pushPrefEnv({"set": [
-    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.PROMPT],
+    ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
     ["media.autoplay.enabled.user-gestures-needed", true],
     ["media.autoplay.ask-permission", true],
   ]});
 
   info("- open new background tab4 -");
   let tab4 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   BrowserTestUtils.loadURI(tab4.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab4.linkedBrowser);