diff --git a/browser/components/preferences/in-content/privacy.js b/browser/components/preferences/in-content/privacy.js
index 19708b635927..7f98753f8d6e 100644
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -77,8 +77,6 @@ Preferences.addAll([
// Media
{ id: "media.autoplay.default", type: "int" },
- { id: "media.autoplay.enabled.ask-permission", type: "bool" },
- { id: "media.autoplay.enabled.user-gestures-needed", type: "bool" },
// Popups
{ id: "dom.disable_open_during_load", type: "bool" },
@@ -271,8 +269,6 @@ var gPrivacyPane = {
init() {
this._updateSanitizeSettingsButton();
this.initializeHistoryMode();
- this.initAutoplay();
- this.updateAutoplayMediaControlsVisibility();
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingReverter();
@@ -281,10 +277,14 @@ var gPrivacyPane = {
/* Initialize Content Blocking */
this.initContentBlocking();
+ this.blockAutoplayReadPrefs();
this.trackingProtectionReadPrefs();
this.networkCookieBehaviorReadPrefs();
this._initTrackingProtectionExtensionControl();
+ Preferences.get("media.autoplay.default").on("change",
+ gPrivacyPane.blockAutoplayReadPrefs.bind(gPrivacyPane));
+
Preferences.get("privacy.trackingprotection.enabled").on("change",
gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane));
Preferences.get("privacy.trackingprotection.pbmode.enabled").on("change",
@@ -305,10 +305,6 @@ var gPrivacyPane = {
gPrivacyPane._updateSanitizeSettingsButton.bind(gPrivacyPane));
Preferences.get("browser.privatebrowsing.autostart").on("change",
gPrivacyPane.updatePrivacyMicroControls.bind(gPrivacyPane));
- Preferences.get("media.autoplay.enabled.ask-permission").on("change",
- gPrivacyPane.updateAutoplayMediaControlsVisibility.bind(gPrivacyPane));
- Preferences.get("media.autoplay.enabled.user-gestures-needed").on("change",
- gPrivacyPane.updateAutoplayMediaControlsVisibility.bind(gPrivacyPane));
setEventListener("historyMode", "command", function() {
gPrivacyPane.updateHistoryModePane();
gPrivacyPane.updateHistoryModePrefs();
@@ -366,8 +362,6 @@ var gPrivacyPane = {
gPrivacyPane.toggleAutoplayMedia);
setEventListener("autoplayMediaPolicyButton", "command",
gPrivacyPane.showAutoplayMediaExceptions);
- setEventListener("autoplayMediaPolicyComboboxButton", "command",
- gPrivacyPane.showAutoplayMediaExceptions);
setEventListener("notificationsDoNotDisturb", "command",
gPrivacyPane.toggleDoNotDisturbNotifications);
@@ -1109,10 +1103,10 @@ var gPrivacyPane = {
// MEDIA
- initAutoplay() {
- let url = Services.urlFormatter.formatURLPref("app.support.baseURL") +
- "block-autoplay";
- document.getElementById("autoplayLearnMoreLink").setAttribute("href", url);
+ blockAutoplayReadPrefs() {
+ let blocked =
+ Preferences.get("media.autoplay.default").value == Ci.nsIAutoplay.BLOCKED;
+ document.getElementById("autoplayMediaCheckbox").checked = blocked;
},
/**
@@ -1123,29 +1117,6 @@ var gPrivacyPane = {
Services.prefs.setIntPref("media.autoplay.default", blocked);
},
- /**
- * If user-gestures-needed is false we do not show any UI for configuring autoplay,
- * if user-gestures-needed is false and ask-permission is false we show a checkbox
- * which only allows the user to block autoplay
- * if user-gestures-needed and ask-permission are true we show a combobox that
- * allows the user to block / allow or prompt for autoplay
- * We will be performing a shield study to determine the behaviour to be
- * shipped, at which point we can remove these pref switches.
- * https://bugzilla.mozilla.org/show_bug.cgi?id=1475099
- */
- updateAutoplayMediaControlsVisibility() {
- let askPermission =
- Services.prefs.getBoolPref("media.autoplay.ask-permission", false);
- let userGestures =
- Services.prefs.getBoolPref("media.autoplay.enabled.user-gestures-needed", false);
- // Hide the combobox if we don't let the user ask for permission.
- document.getElementById("autoplayMediaComboboxWrapper").hidden =
- !userGestures || !askPermission;
- // If the user may ask for permission, hide the checkbox instead.
- document.getElementById("autoplayMediaCheckboxWrapper").hidden =
- !userGestures || askPermission;
- },
-
/**
* Displays the autoplay exceptions dialog where specific site autoplay preferences
* can be set.
diff --git a/browser/components/preferences/in-content/privacy.xul b/browser/components/preferences/in-content/privacy.xul
index 973e57b0f7d3..955fc87d4b07 100644
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -558,7 +558,7 @@
-
+
@@ -631,38 +631,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini
index 0f955d31c49f..096fcf7109de 100644
--- a/browser/components/preferences/in-content/tests/browser.ini
+++ b/browser/components/preferences/in-content/tests/browser.ini
@@ -84,7 +84,6 @@ run-if = nightly_build
[browser_spotlight.js]
[browser_site_login_exceptions.js]
[browser_site_autoplay_media_exceptions.js]
-[browser_site_autoplay_media_prompt.js]
[browser_permissions_dialog.js]
[browser_subdialogs.js]
support-files =
diff --git a/browser/components/preferences/in-content/tests/browser_site_autoplay_media_exceptions.js b/browser/components/preferences/in-content/tests/browser_site_autoplay_media_exceptions.js
index 6b9058c1ccf9..125c6fe1f188 100644
--- a/browser/components/preferences/in-content/tests/browser_site_autoplay_media_exceptions.js
+++ b/browser/components/preferences/in-content/tests/browser_site_autoplay_media_exceptions.js
@@ -8,14 +8,10 @@ const PRINCIPAL = Services.scriptSecurityManager
const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
const AUTOPLAY_ENABLED_KEY = "media.autoplay.default";
-const GESTURES_NEEDED_KEY = "media.autoplay.enabled.user-gestures-needed";
-const ASK_PERMISSIONS_KEY = "media.autoplay.enabled.ask-permissions";
var exceptionsDialog;
Services.prefs.setIntPref(AUTOPLAY_ENABLED_KEY, Ci.nsIAutoplay.ALLOWED);
-Services.prefs.setBoolPref(GESTURES_NEEDED_KEY, false);
-Services.prefs.setBoolPref(ASK_PERMISSIONS_KEY, true);
async function openExceptionsDialog() {
let dialogOpened = promiseLoadSubDialog(PERMISSIONS_URL);
@@ -26,25 +22,19 @@ async function openExceptionsDialog() {
exceptionsDialog = await dialogOpened;
}
-add_task(async function ensureCheckboxHidden() {
-
+add_task(async function ensureCheckboxVisible() {
registerCleanupFunction(async function() {
Services.prefs.clearUserPref(AUTOPLAY_ENABLED_KEY);
- Services.prefs.clearUserPref(GESTURES_NEEDED_KEY);
- Services.prefs.clearUserPref(ASK_PERMISSIONS_KEY);
gBrowser.removeCurrentTab();
});
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let win = gBrowser.selectedBrowser.contentWindow;
- is_element_hidden(win.document.getElementById("autoplayMediaPolicy"),
- "Ensure checkbox is hidden when preffed off");
+ is_element_visible(win.document.getElementById("autoplayMediaCheckbox"),
+ "Ensure checkbox is visible");
});
add_task(async function enableBlockingAutoplay() {
-
- Services.prefs.setBoolPref(GESTURES_NEEDED_KEY, true);
-
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
let doc = content.document;
let autoplayCheckBox = doc.getElementById("autoplayMediaCheckbox");
diff --git a/browser/components/preferences/in-content/tests/browser_site_autoplay_media_prompt.js b/browser/components/preferences/in-content/tests/browser_site_autoplay_media_prompt.js
deleted file mode 100644
index 87e9b8fdda99..000000000000
--- a/browser/components/preferences/in-content/tests/browser_site_autoplay_media_prompt.js
+++ /dev/null
@@ -1,114 +0,0 @@
-"use strict";
-
-ChromeUtils.import("resource:///modules/SitePermissions.jsm");
-
-const URL = "http://www.example.com";
-const PRINCIPAL = Services.scriptSecurityManager
- .createCodebasePrincipal(Services.io.newURI(URL), {});
-
-const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
-const AUTOPLAY_ENABLED_KEY = "media.autoplay.default";
-const GESTURES_NEEDED_KEY = "media.autoplay.enabled.user-gestures-needed";
-const ASK_PERMISSIONS_KEY = "media.autoplay.enabled.ask-permissions";
-
-var exceptionsDialog;
-
-Services.prefs.setIntPref(AUTOPLAY_ENABLED_KEY, Ci.nsIAutoplay.ALLOWED);
-Services.prefs.setBoolPref(GESTURES_NEEDED_KEY, false);
-Services.prefs.setBoolPref(ASK_PERMISSIONS_KEY, true);
-
-async function openExceptionsDialog() {
- let dialogOpened = promiseLoadSubDialog(PERMISSIONS_URL);
- await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
- let exceptionsButton = content.document.getElementById("autoplayMediaPolicyButton");
- exceptionsButton.click();
- });
- exceptionsDialog = await dialogOpened;
-}
-
-add_task(async function ensureMenuHidden() {
-
- registerCleanupFunction(async function() {
- Services.prefs.clearUserPref(AUTOPLAY_ENABLED_KEY);
- Services.prefs.clearUserPref(GESTURES_NEEDED_KEY);
- Services.prefs.clearUserPref(ASK_PERMISSIONS_KEY);
- gBrowser.removeCurrentTab();
- });
-
- await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
- let win = gBrowser.selectedBrowser.contentWindow;
- is_element_hidden(win.document.getElementById("autoplayMediaPolicy"),
- "Ensure checkbox is hidden when preffed off");
-});
-
-add_task(async function enableBlockingAutoplay() {
-
- Services.prefs.setBoolPref(GESTURES_NEEDED_KEY, true);
-
- await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
- let doc = content.document;
- let autoplayMenu = doc.getElementById("autoplayMediaPolicyMenu");
- autoplayMenu.click();
- let askMenuItem = autoplayMenu.children[0].children[1];
- askMenuItem.click();
- });
-
- Assert.equal(Services.prefs.getIntPref(AUTOPLAY_ENABLED_KEY),
- Ci.nsIAutoplay.PROMPT,
- "Ensure we have set autoplay to false");
-});
-
-add_task(async function addException() {
- await openExceptionsDialog();
- let doc = exceptionsDialog.document;
-
- let richlistbox = doc.getElementById("permissionsBox");
- Assert.equal(richlistbox.itemCount, 0, "Row count should initially be 0");
-
- let inputBox = doc.getElementById("url");
- inputBox.focus();
-
- EventUtils.sendString(URL, exceptionsDialog);
-
- let btnAllow = doc.getElementById("btnAllow");
- btnAllow.click();
-
- await TestUtils.waitForCondition(() => richlistbox.itemCount == 1);
- Assert.equal(richlistbox.getItemAtIndex(0).getAttribute("origin"), URL);
-
- let permChanged = TestUtils.topicObserved("perm-changed");
- let btnApplyChanges = doc.getElementById("btnApplyChanges");
- btnApplyChanges.click();
- await permChanged;
-
- is(Services.perms.testPermissionFromPrincipal(PRINCIPAL, "autoplay-media"),
- Ci.nsIPermissionManager.ALLOW_ACTION, "Correctly added the exception");
-});
-
-add_task(async function deleteException() {
- await openExceptionsDialog();
- let doc = exceptionsDialog.document;
-
- let richlistbox = doc.getElementById("permissionsBox");
- Assert.equal(richlistbox.itemCount, 1, "Row count should initially be 1");
- richlistbox.focus();
- richlistbox.selectedIndex = 0;
-
- if (AppConstants.platform == "macosx") {
- EventUtils.synthesizeKey("KEY_Backspace");
- } else {
- EventUtils.synthesizeKey("KEY_Delete");
- }
-
- await TestUtils.waitForCondition(() => richlistbox.itemCount == 0);
- is_element_visible(content.gSubDialog._dialogs[0]._box,
- "Subdialog is visible after deleting an element");
-
- let permChanged = TestUtils.topicObserved("perm-changed");
- let btnApplyChanges = doc.getElementById("btnApplyChanges");
- btnApplyChanges.click();
- await permChanged;
-
- is(Services.perms.testPermissionFromPrincipal(PRINCIPAL, "autoplay-media"),
- Ci.nsIPermissionManager.UNKNOWN_ACTION, "Correctly removed the exception");
-});
diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
index 6d5a75b14448..bc24ea3931e7 100644
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -900,21 +900,10 @@ permissions-block-autoplay-media =
.label = Block websites from automatically playing media with sound
.accesskey = B
-permissions-block-autoplay-media-menu = For websites that autoplay sound
-
permissions-block-autoplay-media-exceptions =
.label = Exceptions…
.accesskey = E
-autoplay-option-ask =
- .label = Always Ask
-autoplay-option-allow =
- .label = Allow Autoplay
-autoplay-option-dont =
- .label = Don't Autoplay
-
-permissions-autoplay-link = Learn more
-
permissions-block-popups =
.label = Block pop-up windows
.accesskey = B