mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
bug 234183 Cookie Manager cleanup for 1.7b, r=mvl sr=jag
This commit is contained in:
parent
49e84804c3
commit
b1bade834e
@ -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)
|
||||
|
@ -5,6 +5,7 @@
|
||||
<!ENTITY treehead.cookiename.label "Cookie Name">
|
||||
<!ENTITY treehead.cookiedomain.label "Site">
|
||||
<!ENTITY treehead.cookiestatus.label "Status">
|
||||
<!ENTITY treehead.cookieexpires.label "Expires">
|
||||
<!ENTITY treehead.infoselected.label "Information about the selected Cookie">
|
||||
<!ENTITY button.removecookie.label "Remove Cookie">
|
||||
<!ENTITY button.removeallcookies.label "Remove All 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)
|
||||
|
@ -5,6 +5,7 @@
|
||||
<!ENTITY treehead.cookiename.label "Cookie Name">
|
||||
<!ENTITY treehead.cookiedomain.label "Site">
|
||||
<!ENTITY treehead.cookiestatus.label "Status">
|
||||
<!ENTITY treehead.cookieexpires.label "Expires">
|
||||
<!ENTITY treehead.infoselected.label "Information about the selected Cookie">
|
||||
<!ENTITY button.removecookie.label "Remove Cookie">
|
||||
<!ENTITY button.removeallcookies.label "Remove All Cookies">
|
||||
|
Loading…
Reference in New Issue
Block a user