diff --git a/suite/common/permissions/aboutPopups.xul b/suite/common/permissions/aboutPopups.xul
new file mode 100644
index 000000000000..13b3ab1f5dbf
--- /dev/null
+++ b/suite/common/permissions/aboutPopups.xul
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+ %brandDTD;
+
+ %aboutPopupsDTD;
+]>
+
+
diff --git a/suite/common/permissions/permissionsManager.js b/suite/common/permissions/permissionsManager.js
index 57edfeab404c..7b4125a84f58 100644
--- a/suite/common/permissions/permissionsManager.js
+++ b/suite/common/permissions/permissionsManager.js
@@ -24,24 +24,15 @@
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const popupType = nsIPermissionManager.POPUP_TYPE;
-var popupManager = null;
var permissionManager = null;
var permissions = [];
-var listCapability; // the capability of sites on the currently viewed list
-// TRUE: current popup policy is BLOCK ALL WITH EXCEPTIONS - sites on
-// the whitelist are allowed and have permission.capability = true
-// FALSE: current popup policy is ALLOW ALL WITH EXCEPTIONS - sites on
-// the blacklist are blocked and have permission.capability = false
-
var additions = [];
var removals = [];
-const SIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1";
-
var sortColumn = "host";
-var lastSort = false;
+var sortAscending = false;
var permissionsTreeView = {
rowCount: 0,
@@ -66,76 +57,27 @@ var permissionsTree;
var popupStringBundle;
function Startup() {
- popupManager = Components.classes["@mozilla.org/PopupWindowManager;1"]
- .getService(Components.interfaces.nsIPopupWindowManager);
permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(Components.interfaces.nsIPermissionManager);
+ .getService(Components.interfaces.nsIPermissionManager);
permissionsTree = document.getElementById("permissionsTree");
popupStringBundle = document.getElementById("popupStringBundle");
- var title;
- if (window.arguments[0]) {
- document.getElementById("blockExcept").hidden = false;
- lastSort = (permissionsTree.getAttribute("lastSortWhitelist") == "true");
- title = popupStringBundle.getString("whitelistTitle");
- }
- else {
- document.getElementById("allowExcept").hidden = false;
- lastSort = (permissionsTree.getAttribute("lastSortBlacklist") == "true");
- title = popupStringBundle.getString("blacklistTitle");
- }
+ // window.args[0]: host to prefill
+ // window.args[1]: true = opened from pref panel, false = opened from tools menu or statusbar icon
- document.getElementById("popupManager").setAttribute("title", title);
-
- listCapability = window.arguments[0];
+ sortAscending = (permissionsTree.getAttribute("sortAscending") == "true");
loadPermissions(permissions);
loadTree();
- if (window.arguments[1]) { // dialog opened from statusbar icon
- if (listCapability) {
- document.getElementById("addSiteBox").value = window.arguments[1];
- }
- else {
- // pre-pend '.' so we always match on host boundaries. Otherwise
- // we might think notfoo.com matches foo.com
- var currentLoc = '.'+window.arguments[1];
- var nextHost;
- var inList;
-
- var matchIndex;
- var matchLength = 0;
-
- for (var i = 0; i < permissionsTreeView.rowCount; i++) {
- nextHost = '.'+permissions[i].host;
-
- if (currentLoc.length < nextHost.length)
- continue; // can't be a match, list host is more specific
-
- // look for an early out exact match -- check length first for speed
- if (currentLoc.length == nextHost.length && nextHost == currentLoc) {
- inList = true;
- matchIndex = i;
- break;
- }
-
- if (nextHost == currentLoc.substr(currentLoc.length - nextHost.length)) {
- inList = true;
- if (listCapability) // host is already on whitelist, don't prefill
- break;
-
- if (nextHost.length > matchLength) {
- matchIndex = i;
- matchLength = nextHost.length;
- }
- }
- }
-
- if (inList) // host is in blacklist, select for removal
- permissionsTree.treeBoxObject.view.selection.select(matchIndex);
- }
+ if (window.arguments[0] != "") {
+ // fill textbox to unblock/add to whitelist
+ var prefill = window.arguments[0];
+ if (prefill.indexOf("www.") == 0)
+ prefill = prefill.slice(4);
+ document.getElementById("addSiteBox").value = prefill;
}
document.documentElement.addEventListener("keypress", onReturnHit, true);
@@ -143,19 +85,47 @@ function Startup() {
window.sizeToContent();
}
+function getMatch(host) {
+ // pre-pend '.' so we always match on host boundaries. Otherwise
+ // we might think notfoo.com matches foo.com
+ var currentLoc = '.'+host;
+ var nextHost;
+ var inList;
+
+ var matchIndex = null;
+ var matchLength = 0;
+
+ for (var i = 0; i < permissionsTreeView.rowCount; i++) {
+ nextHost = '.'+permissions[i].host;
+
+ if (currentLoc.length < nextHost.length)
+ continue; // can't be a match, list host is more specific
+
+ // look for an early out exact match -- check length first for speed
+ if (currentLoc.length == nextHost.length && nextHost == currentLoc) {
+ inList = true;
+ matchIndex = i;
+ break;
+ }
+
+ if (nextHost == currentLoc.substr(currentLoc.length - nextHost.length)) {
+ inList = true;
+ if (nextHost.length > matchLength) {
+ matchIndex = i;
+ matchLength = nextHost.length;
+ }
+ }
+ }
+
+ return matchIndex;
+}
+
function onAccept() {
finalizeChanges();
- var unblocked;
+ var unblocked = additions;
- if (listCapability) {
- unblocked = additions;
- permissionsTree.setAttribute("lastSortWhitelist", !lastSort);
- }
- else {
- unblocked = removals;
- permissionsTree.setAttribute("lastSortBlacklist", !lastSort);
- }
+ permissionsTree.setAttribute("sortAscending", !sortAscending);
var nextLocation;
var nextUnblocked;
@@ -195,10 +165,9 @@ function onAccept() {
}
}
- if (window.arguments[2])
+ if (window.arguments[1])
window.opener.setButtons();
-
return true;
}
@@ -215,8 +184,7 @@ function loadPermissions(table) {
var permission = enumerator.getNext();
if (permission) {
permission = permission.QueryInterface(Components.interfaces.nsIPermission);
- if ((permission.type == popupType) &&
- (permission.capability == listCapability)) {
+ if ((permission.type == popupType) && (permission.capability == nsIPermissionManager.ALLOW_ACTION)) {
var host = permission.host;
table[count] = new Permission(host,count++);
}
@@ -237,9 +205,9 @@ function loadTree() {
}
function permissionColumnSort() {
- lastSort =
+ sortAscending =
SortTree(permissionsTree, permissionsTreeView, permissions,
- sortColumn, sortColumn, lastSort);
+ sortColumn, sortColumn, sortAscending);
}
function permissionSelected() {
@@ -327,8 +295,7 @@ function finalizeChanges() {
var uri;
var host;
var i;
-
- var perm = (listCapability == true) ? nsIPermissionManager.ALLOW_ACTION : nsIPermissionManager.DENY_ACTION
+
//note: the scheme will be taken off later, it is being added now only to
//create the uri for add/remove
for (i in additions) {
@@ -336,7 +303,7 @@ function finalizeChanges() {
if (host != null) {
host = "http://" + host;
uri = ioService.newURI(host, null, null);
- permissionManager.add(uri, popupType, listCapability);
+ permissionManager.add(uri, popupType, true);
}
}
@@ -402,7 +369,7 @@ function addPermission() {
var newPermission = new Permission(host, length);
permissions.push(newPermission);
- lastSort = !lastSort; //keep same sort direction
+ sortAscending = !sortAscending; //keep same sort direction
loadTree();
if (removals[host] != null)
@@ -434,7 +401,7 @@ function onReturnHit(event) {
}
function doHelpButton() {
- openHelp("pop_up_blocking_prefs");
+ openHelp("pop_up_blocking");
return true;
}
diff --git a/suite/common/permissions/permissionsManager.xul b/suite/common/permissions/permissionsManager.xul
index 978b6d5aa9d3..3b99d1a5569e 100644
--- a/suite/common/permissions/permissionsManager.xul
+++ b/suite/common/permissions/permissionsManager.xul
@@ -58,8 +58,7 @@
-
-
+
@@ -78,8 +77,8 @@
hidecolumnpicker="true"
onkeypress="handlePermissionKeyPress(event)"
onselect="permissionSelected();"
- lastSortBlacklist="false" lastSortWhitelist="false"
- persist="lastSortBlacklist lastSortWhitelist">
+ sortAscending="false"
+ persist="sortAscending">
diff --git a/suite/common/permissions/permissionsNavigatorOverlay.xul b/suite/common/permissions/permissionsNavigatorOverlay.xul
index 6b04076820ff..e2fdc4102973 100644
--- a/suite/common/permissions/permissionsNavigatorOverlay.xul
+++ b/suite/common/permissions/permissionsNavigatorOverlay.xul
@@ -110,10 +110,16 @@
var policy = pref.getBoolPref("dom.disable_open_during_load");
blocked = permissionmanager.testPermission(getBrowser().currentURI, nsIPermissionManager.POPUP_TYPE);
+
+ document.getElementById("AboutPopups").hidden = policy;
+ document.getElementById("ManagePopups").hidden = !policy;
- enableElement("BlockPopups", blocked != nsIPermissionManager.DENY_ACTION);
- enableElement("AllowPopups", blocked != nsIPermissionManager.ALLOW_ACTION);
- enableElement("ManagePopups", true);
+ if (policy) {
+ enableElement("AllowPopups", blocked != nsIPermissionManager.ALLOW_ACTION);
+ return;
+ }
+
+ enableElement("AllowPopups", false);
}
function enableElement(elementID, enable) {
@@ -158,32 +164,23 @@
}
}
- function PopupAction(action) {
- var policy = pref.getBoolPref("dom.disable_open_during_load");
- var uri = getBrowser().currentURI;
-
- switch (action) {
- case "block":
- permissionmanager.add(uri, nsIPermissionManager.POPUP_TYPE, nsIPermissionManager.DENY_ACTION);
- break;
- case "allow":
- var browsers = getBrowser().browsers;
- var popupIcon = document.getElementById("popupIcon");
- permissionmanager.add(uri, nsIPermissionManager.POPUP_TYPE, nsIPermissionManager.ALLOW_ACTION);
- for (var i = 0; i < browsers.length; i++) {
- if (browsers[i].popupDomain == uri.host) {
- browsers[i].popupDomain = null;
- popupIcon.hidden = true;
- }
- }
- break;
- }
+ function PopupAction() {
+ var hostPort = getBrowser().currentURI.hostPort;
+ window.openDialog("chrome://communicator/content/popupManager.xul", "",
+ "chrome,resizable=yes,modal=yes",
+ hostPort,
+ false);
}
- function ViewPopupManager() {
+ function OpenAboutPopups() {
+ window.openDialog("chrome://communicator/content/aboutPopups.xul", "",
+ "chrome,centerscreen,resizable=yes",
+ false);
+ }
+
+ function OpenManagePopups() {
window.openDialog("chrome://communicator/content/popupManager.xul", "",
- "chrome,resizable=yes,modal=yes",
- pref.getBoolPref("dom.disable_open_during_load"),
+ "chrome,resizable=yes",
"",
false);
}
@@ -235,18 +232,17 @@
id="popup"
insertbefore="navBeginGlobalItems">
-
-
-
+ oncommand="PopupAction();"/>
+
+
diff --git a/suite/common/permissions/permissionsOverlay.js b/suite/common/permissions/permissionsOverlay.js
index 9a1f4a94e5f5..6717c5d5a51a 100644
--- a/suite/common/permissions/permissionsOverlay.js
+++ b/suite/common/permissions/permissionsOverlay.js
@@ -20,18 +20,12 @@
var COOKIEPERMISSION = 0;
var IMAGEPERMISSION = 1;
-var WINDOWPERMISSION = 2;
function viewImages() {
window.openDialog("chrome://communicator/content/wallet/CookieViewer.xul","_blank",
"chrome,resizable=yes", "imageManager" );
}
-function viewPopups() {
- window.openDialog("chrome://communicator/content/wallet/CookieViewer.xul","_blank",
- "chrome,resizable=yes", "popupManager" );
-}
-
function viewCookies() {
window.openDialog("chrome://communicator/content/wallet/CookieViewer.xul","_blank",
"chrome,resizable=yes", "cookieManager");
diff --git a/suite/locales/en-US/chrome/common/permissions/aboutPopups.dtd b/suite/locales/en-US/chrome/common/permissions/aboutPopups.dtd
new file mode 100644
index 000000000000..17ec1c60c51e
--- /dev/null
+++ b/suite/locales/en-US/chrome/common/permissions/aboutPopups.dtd
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/suite/locales/en-US/chrome/common/permissions/permissionsManager.dtd b/suite/locales/en-US/chrome/common/permissions/permissionsManager.dtd
index e3af863251d2..a09773bd3529 100644
--- a/suite/locales/en-US/chrome/common/permissions/permissionsManager.dtd
+++ b/suite/locales/en-US/chrome/common/permissions/permissionsManager.dtd
@@ -1,8 +1,6 @@
-
+
-
-
-
+
diff --git a/suite/locales/en-US/chrome/common/permissions/permissionsManager.properties b/suite/locales/en-US/chrome/common/permissions/permissionsManager.properties
index 5d50057cbc91..63f17efb30c6 100644
--- a/suite/locales/en-US/chrome/common/permissions/permissionsManager.properties
+++ b/suite/locales/en-US/chrome/common/permissions/permissionsManager.properties
@@ -1,4 +1,2 @@
-blacklistTitle=Popup Exceptions - Suppressed Web Sites
-whitelistTitle=Popup Exceptions - Allowed Web Sites
alertDuplicate=The web site %S already exists in this list.
alertInvalid=The web site %S is invalid.
diff --git a/suite/locales/en-US/chrome/common/permissions/permissionsNavigatorOverlay.dtd b/suite/locales/en-US/chrome/common/permissions/permissionsNavigatorOverlay.dtd
index 2001bf08465b..1f114fca5bea 100644
--- a/suite/locales/en-US/chrome/common/permissions/permissionsNavigatorOverlay.dtd
+++ b/suite/locales/en-US/chrome/common/permissions/permissionsNavigatorOverlay.dtd
@@ -18,14 +18,12 @@
-
-
-
+
-
-
-
-
+
+
+
+