Bug 1211718 - Remove address field from notification permissions dialog. r=MattN
authorJared Wein <jwein@mozilla.com>
Tue, 20 Oct 2015 21:45:00 -0700
changeset 303846 bb1a2ca11712e3b4e390d62a399bf3e8e47cf64e
parent 303845 d0b65ea823489d9794cadb15cffde2f05cf4eafa
child 303847 bde31d612d0818aa064458e2d9b03858284c3ca6
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1211718
milestone44.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 1211718 - Remove address field from notification permissions dialog. r=MattN
browser/components/preferences/in-content/content.js
browser/components/preferences/in-content/tests/browser.ini
browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
browser/locales/en-US/chrome/browser/preferences/preferences.properties
--- a/browser/components/preferences/in-content/content.js
+++ b/browser/components/preferences/in-content/content.js
@@ -116,23 +116,19 @@ var gContentPane = {
 
   /**
    * Displays the notifications exceptions dialog where specific site notification
    * preferences can be set.
    */
   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);
   },
 
 
   // POP-UPS
 
--- a/browser/components/preferences/in-content/tests/browser.ini
+++ b/browser/components/preferences/in-content/tests/browser.ini
@@ -17,16 +17,17 @@ skip-if = os != "win" # This test tests 
 [browser_chunk_permissions.js]
 [browser_connection.js]
 [browser_connection_bug388287.js]
 [browser_cookies_exceptions.js]
 [browser_healthreport.js]
 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]
 [browser_privacypane_4.js]
 [browser_privacypane_5.js]
 [browser_privacypane_8.js]
 skip-if = e10s # Bug ?????? -  "leaked until shutdown [nsGlobalWindow #99 about:preferences]"
 [browser_sanitizeOnShutdown_prefLocked.js]
new file mode 100644
--- /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();
+});
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -20,17 +20,17 @@ acceptVeryLargeMinimumFont=Keep my chang
 #### Permissions Manager
 
 cookiepermissionstext=You can specify which websites are always or never allowed to use cookies.  Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
 cookiepermissionstitle=Exceptions - Cookies
 addonspermissionstext=You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.
 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
 
 #### Block List Manager
 
 blockliststext=You can choose which list Firefox will use to block Web elements that may track your browsing activity.
 blockliststitle=Block Lists