From 49992b316c71dc375dbd9c1cf5676d11062648f3 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Tue, 20 Oct 2015 21:45:00 -0700 Subject: [PATCH] Bug 1211718 - Remove address field from notification permissions dialog. r=MattN --- .../preferences/in-content/content.js | 8 +--- .../preferences/in-content/tests/browser.ini | 1 + .../browser_permissions_urlFieldHidden.js | 45 +++++++++++++++++++ .../preferences/preferences.properties | 2 +- 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js diff --git a/browser/components/preferences/in-content/content.js b/browser/components/preferences/in-content/content.js index 267d464af59..50f33edd86c 100644 --- a/browser/components/preferences/in-content/content.js +++ b/browser/components/preferences/in-content/content.js @@ -121,13 +121,9 @@ var gContentPane = { showNotificationExceptions() { let bundlePreferences = document.getElementById("bundlePreferences"); - let params = { blockVisible: true, - sessionVisible: false, - allowVisible: true, - prefilledHost: "", - permissionType: "desktop-notification" }; + let params = { permissionType: "desktop-notification" }; params.windowTitle = bundlePreferences.getString("notificationspermissionstitle"); - params.introText = bundlePreferences.getString("notificationspermissionstext"); + params.introText = bundlePreferences.getString("notificationspermissionstext2"); gSubDialog.open("chrome://browser/content/preferences/permissions.xul", "resizable=yes", params); diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini index 1f170b4f4dc..c1dd9156f6f 100644 --- a/browser/components/preferences/in-content/tests/browser.ini +++ b/browser/components/preferences/in-content/tests/browser.ini @@ -22,6 +22,7 @@ skip-if = os != "win" # This test tests the windows-specific app selection dialo skip-if = !healthreport || (os == 'linux' && debug) [browser_notifications_do_not_disturb.js] [browser_permissions.js] +[browser_permissions_urlFieldHidden.js] [browser_proxy_backup.js] [browser_privacypane_1.js] [browser_privacypane_3.js] diff --git a/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js b/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js new file mode 100644 index 00000000000..84f4d90f057 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js @@ -0,0 +1,45 @@ +"use strict"; + +const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul"; + +add_task(function* urlFieldVisibleForPopupPermissions(finish) { + yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true}); + let win = gBrowser.selectedBrowser.contentWindow; + let doc = win.document; + let popupPolicyCheckbox = doc.getElementById("popupPolicy"); + ok(!popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default"); + popupPolicyCheckbox.click(); + let popupPolicyButton = doc.getElementById("popupPolicyButton"); + ok(popupPolicyButton, "popupPolicyButton found"); + let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL); + popupPolicyButton.click(); + let dialog = yield dialogPromise; + ok(dialog, "dialog loaded"); + + let urlLabel = dialog.document.getElementById("urlLabel"); + ok(!urlLabel.hidden, "urlLabel should be visible when one of block/session/allow visible"); + let url = dialog.document.getElementById("url"); + ok(!url.hidden, "url should be visible when one of block/session/allow visible"); + + popupPolicyCheckbox.click(); + gBrowser.removeCurrentTab(); +}); + +add_task(function* urlFieldHiddenForNotificationPermissions() { + yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true}); + let win = gBrowser.selectedBrowser.contentWindow; + let doc = win.document; + let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton"); + ok(notificationsPolicyButton, "notificationsPolicyButton found"); + let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL); + notificationsPolicyButton.click(); + let dialog = yield dialogPromise; + ok(dialog, "dialog loaded"); + + let urlLabel = dialog.document.getElementById("urlLabel"); + ok(urlLabel.hidden, "urlLabel should be hidden as requested"); + let url = dialog.document.getElementById("url"); + ok(url.hidden, "url should be hidden as requested"); + + gBrowser.removeCurrentTab(); +}); diff --git a/browser/locales/en-US/chrome/browser/preferences/preferences.properties b/browser/locales/en-US/chrome/browser/preferences/preferences.properties index 2b8da2a3b42..1876c50a844 100644 --- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties +++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties @@ -25,7 +25,7 @@ addonspermissionstext=You can specify which websites are allowed to install add- addons_permissions_title=Allowed Sites - Add-ons Installation popuppermissionstext=You can specify which websites are allowed to open pop-up windows. Type the exact address of the site you want to allow and then click Allow. popuppermissionstitle=Allowed Sites - Pop-ups -notificationspermissionstext=You can specify which websites are always or never allowed to show notifications. Type the exact address of the site you want to manage and then click Block or Allow. +notificationspermissionstext2=Control which websites are always or never allowed to show notifications. If you remove a site, it will need to request permission again. notificationspermissionstitle=Notification Permissions invalidURI=Please enter a valid hostname invalidURITitle=Invalid Hostname Entered