bug 234183 Cookie Manager cleanup for 1.7b, r=mvl sr=jag

This commit is contained in:
mconnor%myrealbox.com 2004-03-09 23:58:10 +00:00
Родитель c7e9ff636c
Коммит 54451b30e4
8 изменённых файлов: 184 добавлений и 104 удалений

Просмотреть файл

@ -172,12 +172,19 @@ var cookiesTreeView = {
getCellValue : function(row,column) {},
getCellText : function(row,column){
var rv="";
if (column=="domainCol") {
switch (column) {
case "domainCol":
rv = cookies[row].rawHost;
} else if (column=="nameCol") {
break;
case "nameCol":
rv = cookies[row].name;
} else if (column=="statusCol") {
break;
case "statusCol":
rv = cookies[row].status;
break;
case "expiresCol":
rv = cookies[row].expires;
break;
}
return rv;
},
@ -201,7 +208,8 @@ function Cookie(number,name,value,isDomain,host,rawHost,path,isSecure,expires,
this.rawHost = rawHost;
this.path = path;
this.isSecure = isSecure;
this.expires = expires;
this.expires = GetExpiresString(expires);
this.expiresSortValue = expires;
this.status = GetStatusString(status);
this.policy = policy;
}
@ -319,7 +327,7 @@ function CookieSelected() {
// Something got out of synch. See bug 119812 for details
dump("Tree and viewer state are out of sync! " +
"Help us figure out the problem in bug 119812");
return;
return false;
}
var props = [
@ -334,7 +342,7 @@ function CookieSelected() {
value: cookies[idx].isSecure ?
cookieBundle.getString("forSecureOnly") :
cookieBundle.getString("forAnyConnection")},
{id: "ifl_expires", value: GetExpiresString(cookies[idx].expires)},
{id: "ifl_expires", value: cookies[idx].expires},
{id: "ifl_policy", value: GetPolicyString(cookies[idx].policy)}
];
@ -407,9 +415,38 @@ var lastCookieSortAscending = false;
function CookieColumnSort(column) {
lastCookieSortAscending =
SortTree(cookiesTree, cookiesTreeView, cookies,
column, lastCookieSortColumn, lastCookieSortAscending);
SortTree(cookiesTree, cookiesTreeView, cookies,
column, lastCookieSortColumn, lastCookieSortAscending);
lastCookieSortColumn = column;
// set the sortDirection attribute to get the styling going
// first we need to get the right element
var sortedCol;
switch (column) {
case "rawHost":
sortedCol = document.getElementById("domainCol");
break;
case "name":
sortedCol = document.getElementById("nameCol");
break;
case "expires":
sortedCol = document.getElementById("expiresCol");
break;
case "status":
sortedCol = document.getElementById("statusCol");
break;
}
if (lastCookieSortAscending)
sortedCol.setAttribute("sortDirection", "descending");
else
sortedCol.setAttribute("sortDirection", "ascending");
// clear out the sortDirection attribute on the rest of the columns
var currentCol = sortedCol.parentNode.firstChild;
while (currentCol) {
if (currentCol != sortedCol && currentCol.localName == "treecol")
currentCol.removeAttribute("sortDirection");
currentCol = currentCol.nextSibling;
}
}
/*** =================== PERMISSIONS CODE =================== ***/
@ -424,7 +461,7 @@ var permissionsTreeView = {
var rv="";
if (column=="siteCol") {
rv = permissions[row].rawHost;
} else if (column=="statusCol") {
} else if (column=="capabilityCol") {
rv = permissions[row].capability;
}
return rv;
@ -601,6 +638,29 @@ function PermissionColumnSort(column, updateSelection) {
column, lastPermissionSortColumn, lastPermissionSortAscending,
updateSelection);
lastPermissionSortColumn = column;
// make sure sortDirection is set
var sortedCol;
switch (column) {
case "rawHost":
sortedCol = document.getElementById("siteCol");
break;
case "capability":
sortedCol = document.getElementById("capabilityCol");
break;
}
if (lastPermissionSortAscending)
sortedCol.setAttribute("sortDirection", "descending");
else
sortedCol.setAttribute("sortDirection", "ascending");
// clear out the sortDirection attribute on the rest of the columns
var currentCol = sortedCol.parentNode.firstChild;
while (currentCol) {
if (currentCol != sortedCol && currentCol.localName == "treecol")
currentCol.removeAttribute("sortDirection");
currentCol = currentCol.nextSibling;
}
}
/*** ============ CODE FOR HELP BUTTON =================== ***/

Просмотреть файл

@ -62,13 +62,16 @@
onselect="CookieSelected();">
<treecols>
<treecol id="domainCol" label="&treehead.cookiedomain.label;" flex="5"
onclick="CookieColumnSort('rawHost', true);" persist="width"/>
onclick="CookieColumnSort('rawHost', true);" persist="width hidden"/>
<splitter class="tree-splitter"/>
<treecol id="nameCol" label="&treehead.cookiename.label;" flex="5"
onclick="CookieColumnSort('name', true);" persist="width"/>
onclick="CookieColumnSort('name', true);" persist="width hidden"/>
<splitter class="tree-splitter"/>
<treecol id="expiresCol" label="&treehead.cookieexpires.label;" flex="10"
hidden="true" onclick="CookieColumnSort('expires', true);" persist="width hidden"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" label="&treehead.cookiestatus.label;" flex="1"
hidden="true" onclick="CookieColumnSort('status', true);" persist="width"/>
hidden="true" onclick="CookieColumnSort('status', true);" persist="width hidden"/>
</treecols>
<treechildren/>
</tree>
@ -170,7 +173,7 @@
<treecol id="siteCol" label="&treehead.sitename.label;" flex="5"
onclick="PermissionColumnSort('rawHost', true);" persist="width"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" label="&treehead.status.label;" flex="5"
<treecol id="capabilityCol" label="&treehead.status.label;" flex="5"
onclick="PermissionColumnSort('capability', true);" persist="width"/>
</treecols>
<treechildren/>

Просмотреть файл

@ -115,8 +115,22 @@ function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending,
var ascending = (column == lastSortColumn) ? !lastSortAscending : true;
// do the sort or re-sort
var compareFunc = function compare(first, second) {
return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
// this is a temporary hack for 1.7, we should implement
// display and sort variables here for trees in general
var compareFunc;
if (column == "expires") {
compareFunc = function compare(first, second) {
if (first.expiresSortValue > second.expiresSortValue)
return 1;
else if (first.expiresSortValue < second.expiresSortValue)
return -1;
else
return 0;
}
} else {
compareFunc = function compare(first, second) {
return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
}
}
table.sort(compareFunc);
if (!ascending)

Просмотреть файл

@ -1,37 +0,0 @@
<!ENTITY tab.cookiesonsystem.label "Stored Cookies">
<!ENTITY tab.bannedservers.label "Cookie Sites">
<!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">
<!ENTITY treehead.cookiestatus.label "Status">
<!ENTITY treehead.infoselected.label "Information about the selected Cookie">
<!ENTITY button.removecookie.label "Remove Cookie">
<!ENTITY button.removeallcookies.label "Remove All Cookies">
<!ENTITY props.name.label "Name:">
<!ENTITY props.value.label "Content:">
<!ENTITY props.domain.label "Host:">
<!ENTITY props.path.label "Path:">
<!ENTITY props.secure.label "Send For:">
<!ENTITY props.expires.label "Expires:">
<!ENTITY props.policy.label "Policy:">
<!ENTITY treehead.sitename.label "Site">
<!ENTITY treehead.status.label "Status">
<!ENTITY windowtitle.label "Cookie Manager">
<!ENTITY blockSite.label "Block">
<!ENTITY allowSite.label "Allow">
<!ENTITY allowSiteSession.label "Session">
<!ENTITY removepermission.label "Remove Site">
<!ENTITY removeallpermissions.label "Remove All Sites">
<!ENTITY removeimage.label "Remove Site">
<!ENTITY removeallimages.label "Remove All Sites">
<!ENTITY canSet.label "can set cookies">
<!ENTITY cannotSet.label "cannot set cookies">
<!ENTITY canLoad.label "can load images">
<!ENTITY cannotLoad.label "cannot load images">
<!ENTITY checkbox.label "Don't allow sites that set removed cookies to set future cookies">

Просмотреть файл

@ -172,12 +172,19 @@ var cookiesTreeView = {
getCellValue : function(row,column) {},
getCellText : function(row,column){
var rv="";
if (column=="domainCol") {
switch (column) {
case "domainCol":
rv = cookies[row].rawHost;
} else if (column=="nameCol") {
break;
case "nameCol":
rv = cookies[row].name;
} else if (column=="statusCol") {
break;
case "statusCol":
rv = cookies[row].status;
break;
case "expiresCol":
rv = cookies[row].expires;
break;
}
return rv;
},
@ -201,7 +208,8 @@ function Cookie(number,name,value,isDomain,host,rawHost,path,isSecure,expires,
this.rawHost = rawHost;
this.path = path;
this.isSecure = isSecure;
this.expires = expires;
this.expires = GetExpiresString(expires);
this.expiresSortValue = expires;
this.status = GetStatusString(status);
this.policy = policy;
}
@ -319,7 +327,7 @@ function CookieSelected() {
// Something got out of synch. See bug 119812 for details
dump("Tree and viewer state are out of sync! " +
"Help us figure out the problem in bug 119812");
return;
return false;
}
var props = [
@ -334,7 +342,7 @@ function CookieSelected() {
value: cookies[idx].isSecure ?
cookieBundle.getString("forSecureOnly") :
cookieBundle.getString("forAnyConnection")},
{id: "ifl_expires", value: GetExpiresString(cookies[idx].expires)},
{id: "ifl_expires", value: cookies[idx].expires},
{id: "ifl_policy", value: GetPolicyString(cookies[idx].policy)}
];
@ -407,9 +415,38 @@ var lastCookieSortAscending = false;
function CookieColumnSort(column) {
lastCookieSortAscending =
SortTree(cookiesTree, cookiesTreeView, cookies,
column, lastCookieSortColumn, lastCookieSortAscending);
SortTree(cookiesTree, cookiesTreeView, cookies,
column, lastCookieSortColumn, lastCookieSortAscending);
lastCookieSortColumn = column;
// set the sortDirection attribute to get the styling going
// first we need to get the right element
var sortedCol;
switch (column) {
case "rawHost":
sortedCol = document.getElementById("domainCol");
break;
case "name":
sortedCol = document.getElementById("nameCol");
break;
case "expires":
sortedCol = document.getElementById("expiresCol");
break;
case "status":
sortedCol = document.getElementById("statusCol");
break;
}
if (lastCookieSortAscending)
sortedCol.setAttribute("sortDirection", "descending");
else
sortedCol.setAttribute("sortDirection", "ascending");
// clear out the sortDirection attribute on the rest of the columns
var currentCol = sortedCol.parentNode.firstChild;
while (currentCol) {
if (currentCol != sortedCol && currentCol.localName == "treecol")
currentCol.removeAttribute("sortDirection");
currentCol = currentCol.nextSibling;
}
}
/*** =================== PERMISSIONS CODE =================== ***/
@ -424,7 +461,7 @@ var permissionsTreeView = {
var rv="";
if (column=="siteCol") {
rv = permissions[row].rawHost;
} else if (column=="statusCol") {
} else if (column=="capabilityCol") {
rv = permissions[row].capability;
}
return rv;
@ -601,6 +638,29 @@ function PermissionColumnSort(column, updateSelection) {
column, lastPermissionSortColumn, lastPermissionSortAscending,
updateSelection);
lastPermissionSortColumn = column;
// make sure sortDirection is set
var sortedCol;
switch (column) {
case "rawHost":
sortedCol = document.getElementById("siteCol");
break;
case "capability":
sortedCol = document.getElementById("capabilityCol");
break;
}
if (lastPermissionSortAscending)
sortedCol.setAttribute("sortDirection", "descending");
else
sortedCol.setAttribute("sortDirection", "ascending");
// clear out the sortDirection attribute on the rest of the columns
var currentCol = sortedCol.parentNode.firstChild;
while (currentCol) {
if (currentCol != sortedCol && currentCol.localName == "treecol")
currentCol.removeAttribute("sortDirection");
currentCol = currentCol.nextSibling;
}
}
/*** ============ CODE FOR HELP BUTTON =================== ***/

Просмотреть файл

@ -62,13 +62,16 @@
onselect="CookieSelected();">
<treecols>
<treecol id="domainCol" label="&treehead.cookiedomain.label;" flex="5"
onclick="CookieColumnSort('rawHost', true);" persist="width"/>
onclick="CookieColumnSort('rawHost', true);" persist="width hidden"/>
<splitter class="tree-splitter"/>
<treecol id="nameCol" label="&treehead.cookiename.label;" flex="5"
onclick="CookieColumnSort('name', true);" persist="width"/>
onclick="CookieColumnSort('name', true);" persist="width hidden"/>
<splitter class="tree-splitter"/>
<treecol id="expiresCol" label="&treehead.cookieexpires.label;" flex="10"
hidden="true" onclick="CookieColumnSort('expires', true);" persist="width hidden"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" label="&treehead.cookiestatus.label;" flex="1"
hidden="true" onclick="CookieColumnSort('status', true);" persist="width"/>
hidden="true" onclick="CookieColumnSort('status', true);" persist="width hidden"/>
</treecols>
<treechildren/>
</tree>
@ -170,7 +173,7 @@
<treecol id="siteCol" label="&treehead.sitename.label;" flex="5"
onclick="PermissionColumnSort('rawHost', true);" persist="width"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" label="&treehead.status.label;" flex="5"
<treecol id="capabilityCol" label="&treehead.status.label;" flex="5"
onclick="PermissionColumnSort('capability', true);" persist="width"/>
</treecols>
<treechildren/>

Просмотреть файл

@ -115,8 +115,22 @@ function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending,
var ascending = (column == lastSortColumn) ? !lastSortAscending : true;
// do the sort or re-sort
var compareFunc = function compare(first, second) {
return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
// this is a temporary hack for 1.7, we should implement
// display and sort variables here for trees in general
var compareFunc;
if (column == "expires") {
compareFunc = function compare(first, second) {
if (first.expiresSortValue > second.expiresSortValue)
return 1;
else if (first.expiresSortValue < second.expiresSortValue)
return -1;
else
return 0;
}
} else {
compareFunc = function compare(first, second) {
return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
}
}
table.sort(compareFunc);
if (!ascending)

Просмотреть файл

@ -1,37 +0,0 @@
<!ENTITY tab.cookiesonsystem.label "Stored Cookies">
<!ENTITY tab.bannedservers.label "Cookie Sites">
<!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">
<!ENTITY treehead.cookiestatus.label "Status">
<!ENTITY treehead.infoselected.label "Information about the selected Cookie">
<!ENTITY button.removecookie.label "Remove Cookie">
<!ENTITY button.removeallcookies.label "Remove All Cookies">
<!ENTITY props.name.label "Name:">
<!ENTITY props.value.label "Content:">
<!ENTITY props.domain.label "Host:">
<!ENTITY props.path.label "Path:">
<!ENTITY props.secure.label "Send For:">
<!ENTITY props.expires.label "Expires:">
<!ENTITY props.policy.label "Policy:">
<!ENTITY treehead.sitename.label "Site">
<!ENTITY treehead.status.label "Status">
<!ENTITY windowtitle.label "Cookie Manager">
<!ENTITY blockSite.label "Block">
<!ENTITY allowSite.label "Allow">
<!ENTITY allowSiteSession.label "Session">
<!ENTITY removepermission.label "Remove Site">
<!ENTITY removeallpermissions.label "Remove All Sites">
<!ENTITY removeimage.label "Remove Site">
<!ENTITY removeallimages.label "Remove All Sites">
<!ENTITY canSet.label "can set cookies">
<!ENTITY cannotSet.label "cannot set cookies">
<!ENTITY canLoad.label "can load images">
<!ENTITY cannotLoad.label "cannot load images">
<!ENTITY checkbox.label "Don't allow sites that set removed cookies to set future cookies">