mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
Bug 222553 Rework cookieviewer to support whitelisting
patch by mpconnor@rogers.com r=neil sr=alecf
This commit is contained in:
parent
3d75f2881a
commit
45c2bb8d16
@ -485,6 +485,27 @@ function DeletePermission() {
|
||||
FinalizePermissionDeletions();
|
||||
}
|
||||
|
||||
function setCookiePermissions(action) {
|
||||
var site = document.getElementById('cookie-site');
|
||||
var url = site.value.replace(/^\s*([-\w]*:\/+)?/, "http://");
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri = ioService.newURI(url, null, null);
|
||||
|
||||
permissionmanager.add(uri, dialogType, action);
|
||||
site.focus();
|
||||
site.value = "";
|
||||
}
|
||||
|
||||
function buttonEnabling(textfield) {
|
||||
// trim any leading space
|
||||
var site = textfield.value.replace(/^\s*([-\w]*:\/+)?/, "");
|
||||
var block = document.getElementById("btnBlock");
|
||||
var allow = document.getElementById("btnAllow");
|
||||
block.disabled = !site;
|
||||
allow.disabled = !site;
|
||||
}
|
||||
|
||||
function DeleteAllPermissions() {
|
||||
DeleteAllFromTree(permissionsTree, permissionsTreeView,
|
||||
permissions, deletedPermissions,
|
||||
|
@ -152,6 +152,14 @@
|
||||
<vbox id="servers" flex="1">
|
||||
<description id="permissionsText" value="&div.bannedservers.label;"/>
|
||||
<separator class="thin"/>
|
||||
<hbox>
|
||||
<textbox id="cookie-site" flex="1" oninput="buttonEnabling(this);"/>
|
||||
<button id="btnBlock" label="&blockSite.label;" disabled="true"
|
||||
oncommand="setCookiePermissions(nsIPermissionManager.DENY_ACTION);"/>
|
||||
<button id="btnAllow" label="&allowSite.label;" disabled="true"
|
||||
oncommand="setCookiePermissions(nsIPermissionManager.ALLOW_ACTION);"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<tree id="permissionsTree" flex="1" style="height: 10em;"
|
||||
hidecolumnpicker="true"
|
||||
onkeypress="HandlePermissionKeyPress(event)"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!ENTITY tab.cookiesonsystem.label "Stored Cookies">
|
||||
<!ENTITY tab.bannedservers.label "Cookie Sites">
|
||||
<!ENTITY div.bannedservers.label "Sites that can and cannot store cookies on your computer.">
|
||||
<!ENTITY div.bannedservers.label "Manage sites that can and cannot store cookies on your computer.">
|
||||
<!ENTITY div.cookiesonsystem.label "View and remove cookies that are stored on your computer.">
|
||||
<!ENTITY treehead.cookiename.label "Cookie Name">
|
||||
<!ENTITY treehead.cookiedomain.label "Site">
|
||||
@ -21,7 +21,8 @@
|
||||
<!ENTITY treehead.status.label "Status">
|
||||
<!ENTITY windowtitle.label "Cookie Manager">
|
||||
|
||||
<!ENTITY addpermission.label "New Site">
|
||||
<!ENTITY blockSite.label "Block">
|
||||
<!ENTITY allowSite.label "Allow">
|
||||
<!ENTITY removepermission.label "Remove Site">
|
||||
<!ENTITY removeallpermissions.label "Remove All Sites">
|
||||
<!ENTITY removeimage.label "Remove Site">
|
||||
|
@ -485,6 +485,27 @@ function DeletePermission() {
|
||||
FinalizePermissionDeletions();
|
||||
}
|
||||
|
||||
function setCookiePermissions(action) {
|
||||
var site = document.getElementById('cookie-site');
|
||||
var url = site.value.replace(/^\s*([-\w]*:\/+)?/, "http://");
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri = ioService.newURI(url, null, null);
|
||||
|
||||
permissionmanager.add(uri, dialogType, action);
|
||||
site.focus();
|
||||
site.value = "";
|
||||
}
|
||||
|
||||
function buttonEnabling(textfield) {
|
||||
// trim any leading space
|
||||
var site = textfield.value.replace(/^\s*([-\w]*:\/+)?/, "");
|
||||
var block = document.getElementById("btnBlock");
|
||||
var allow = document.getElementById("btnAllow");
|
||||
block.disabled = !site;
|
||||
allow.disabled = !site;
|
||||
}
|
||||
|
||||
function DeleteAllPermissions() {
|
||||
DeleteAllFromTree(permissionsTree, permissionsTreeView,
|
||||
permissions, deletedPermissions,
|
||||
|
@ -152,6 +152,14 @@
|
||||
<vbox id="servers" flex="1">
|
||||
<description id="permissionsText" value="&div.bannedservers.label;"/>
|
||||
<separator class="thin"/>
|
||||
<hbox>
|
||||
<textbox id="cookie-site" flex="1" oninput="buttonEnabling(this);"/>
|
||||
<button id="btnBlock" label="&blockSite.label;" disabled="true"
|
||||
oncommand="setCookiePermissions(nsIPermissionManager.DENY_ACTION);"/>
|
||||
<button id="btnAllow" label="&allowSite.label;" disabled="true"
|
||||
oncommand="setCookiePermissions(nsIPermissionManager.ALLOW_ACTION);"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<tree id="permissionsTree" flex="1" style="height: 10em;"
|
||||
hidecolumnpicker="true"
|
||||
onkeypress="HandlePermissionKeyPress(event)"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!ENTITY tab.cookiesonsystem.label "Stored Cookies">
|
||||
<!ENTITY tab.bannedservers.label "Cookie Sites">
|
||||
<!ENTITY div.bannedservers.label "Sites that can and cannot store cookies on your computer.">
|
||||
<!ENTITY div.bannedservers.label "Manage sites that can and cannot store cookies on your computer.">
|
||||
<!ENTITY div.cookiesonsystem.label "View and remove cookies that are stored on your computer.">
|
||||
<!ENTITY treehead.cookiename.label "Cookie Name">
|
||||
<!ENTITY treehead.cookiedomain.label "Site">
|
||||
@ -21,7 +21,8 @@
|
||||
<!ENTITY treehead.status.label "Status">
|
||||
<!ENTITY windowtitle.label "Cookie Manager">
|
||||
|
||||
<!ENTITY addpermission.label "New Site">
|
||||
<!ENTITY blockSite.label "Block">
|
||||
<!ENTITY allowSite.label "Allow">
|
||||
<!ENTITY removepermission.label "Remove Site">
|
||||
<!ENTITY removeallpermissions.label "Remove All Sites">
|
||||
<!ENTITY removeimage.label "Remove Site">
|
||||
|
Loading…
Reference in New Issue
Block a user