зеркало из https://github.com/mozilla/pjs.git
fix cookieviewer bugs 14703 and 14916, approved chofmann
This commit is contained in:
Родитель
8f1552a714
Коммит
f3c248ff76
|
@ -9,7 +9,7 @@
|
|||
|
||||
<!ENTITY props.name.label "Cookie Name:">
|
||||
<!ENTITY props.value.label "Data Stored in Cookie:">
|
||||
<!ENTITY props.domain.label "Server which set the Cookie:">
|
||||
<!ENTITY props.domain.label "Host:">
|
||||
<!ENTITY props.path.label "Path:">
|
||||
<!ENTITY props.secure.label "Is Cookie secure?">
|
||||
<!ENTITY props.expires.label "Cookie will expire on:">
|
||||
|
|
|
@ -1,313 +1,274 @@
|
|||
/* for localization */
|
||||
var Bundle = srGetStrBundle("chrome://wallet/locale/CookieViewer.properties");
|
||||
var siteCookiename = Bundle.GetStringFromName("siteCookiename");
|
||||
var cookiesTab = Bundle.GetStringFromName("cookiesTab");
|
||||
var permissionsTab = Bundle.GetStringFromName("permissionsTab");
|
||||
var cookiesStored = Bundle.GetStringFromName("cookiesStored");
|
||||
var name = Bundle.GetStringFromName("name");
|
||||
var value = Bundle.GetStringFromName("value");
|
||||
var path = Bundle.GetStringFromName("path");
|
||||
var secure = Bundle.GetStringFromName("secure");
|
||||
var expires = Bundle.GetStringFromName("expires");
|
||||
var permissionsStored = Bundle.GetStringFromName("permissionsStored");
|
||||
var removeCmdLabel = Bundle.GetStringFromName("removeCmdLabel");
|
||||
var okCmdLabel = Bundle.GetStringFromName("okCmdLabel");
|
||||
var cancelCmdLabel = Bundle.GetStringFromName("cancelCmdLabel");
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger
|
||||
*/
|
||||
|
||||
/* for xpconnect */
|
||||
var cookieviewer =
|
||||
Components.classes
|
||||
["component://netscape/cookieviewer/cookieviewer-world"].createInstance();
|
||||
cookieviewer = cookieviewer.QueryInterface(Components.interfaces.nsICookieViewer);
|
||||
/*
|
||||
* The cookieList is a sequence of items separated by the BREAK character. These
|
||||
* items are:
|
||||
* empty
|
||||
* number for first cookie
|
||||
* name for first cookie
|
||||
* value for first cookie
|
||||
* domain indicator ("Domain" or "Host") for first cookie
|
||||
* domain or host name for first cookie
|
||||
* path for first cookie
|
||||
* secure indicator ("Yes" or "No") for first cookie
|
||||
* expiration for first cookie
|
||||
* with the eight items above repeated for each successive cookie
|
||||
*/
|
||||
|
||||
function DoGetCookieList()
|
||||
{
|
||||
return cookieviewer.GetCookieValue();
|
||||
}
|
||||
// global variables
|
||||
var cookieviewer = null; // cookieviewer interface
|
||||
var cookieList = []; // array of cookies (OLD STREAM)
|
||||
var cookies = []; // array of cookeis (NEW OBJECT)
|
||||
var permissionList = []; // array of permissions (OLD STREAM)
|
||||
var permissions = []; // array of permissions (NEW OBJECT)
|
||||
var deleted_cookies = [];
|
||||
var deleted_permissions = [];
|
||||
// for dealing with the interface:
|
||||
var gone_c = "";
|
||||
var gone_p = "";
|
||||
// string bundle
|
||||
var bundle = null;
|
||||
// CHANGE THIS WHEN MOVING FILES - strings localization file!
|
||||
var JS_STRINGS_FILE = "chrome://wallet/locale/CookieViewer.properties";
|
||||
|
||||
// function : <CookieViewer.js>::Startup();
|
||||
// purpose : initialises the cookie viewer dialog
|
||||
function Startup()
|
||||
{
|
||||
// xpconnect to cookieviewer interface
|
||||
cookieviewer = Components.classes["component://netscape/cookieviewer/cookieviewer-world"].createInstance();
|
||||
cookieviewer = cookieviewer.QueryInterface(Components.interfaces.nsICookieViewer);
|
||||
// intialise string bundle for
|
||||
bundle = srGetStrBundle(JS_STRINGS_FILE);
|
||||
|
||||
loadCookies();
|
||||
loadPermissions();
|
||||
doSetOKCancel(onOK, null);
|
||||
}
|
||||
|
||||
function DoGetPermissionList()
|
||||
{
|
||||
return cookieviewer.GetPermissionValue();
|
||||
}
|
||||
/*** =================== COOKIES CODE =================== ***/
|
||||
|
||||
function DoSave(value)
|
||||
{
|
||||
cookieviewer.SetValue(value, window);
|
||||
}
|
||||
/* end of xpconnect stuff */
|
||||
// function : <CookieViewer.js>::CreateCookieList();
|
||||
// purpose : creates an array of cookie objects from the cookie stream
|
||||
function CreateCookieList()
|
||||
{
|
||||
count = 0;
|
||||
for(i = 1; i < cookieList.length; i+=8)
|
||||
{
|
||||
cookies[count] = new Cookie();
|
||||
cookies[count].number = cookieList[i+0];
|
||||
cookies[count].name = cookieList[i+1];
|
||||
cookies[count].value = cookieList[i+2];
|
||||
cookies[count].domaintype = cookieList[i+3];
|
||||
cookies[count].domain = cookieList[i+4];
|
||||
cookies[count].path = cookieList[i+5];
|
||||
cookies[count].secure = cookieList[i+6];
|
||||
cookies[count].expire = cookieList[i+7];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
index_frame = 0;
|
||||
title_frame = 1;
|
||||
spacer1_frame = 2;
|
||||
list_frame = 3;
|
||||
spacer2_frame = 4;
|
||||
prop_frame = 5;
|
||||
spacer3_frame = 6;
|
||||
button_frame = 7;
|
||||
// function : <CookieViewer.js>::Cookie();
|
||||
// purpose : an home-brewed object that represents a individual cookie in the stream
|
||||
function Cookie(number,name,value,domaintype,domain,path,secure,expire)
|
||||
{
|
||||
this.number = (arguments.length) ? number : null;
|
||||
this.name = (arguments.length) ? name : null;
|
||||
this.value = (arguments.length) ? value : null;
|
||||
this.domaintype = (arguments.length) ? domaintype : null;
|
||||
this.domain = (arguments.length) ? domain : null;
|
||||
this.path = (arguments.length) ? path : null;
|
||||
this.secure = (arguments.length) ? secure : null;
|
||||
this.expire = (arguments.length) ? expire : null;
|
||||
}
|
||||
|
||||
var cookie_mode;
|
||||
var cookieList = [];
|
||||
var permissionList = [];
|
||||
deleted_cookies = new Array;
|
||||
deleted_permissions = new Array;
|
||||
|
||||
function DeleteItemSelected() {
|
||||
if (cookie_mode == 0) {
|
||||
DeleteCookieSelected();
|
||||
} else if (cookie_mode == 1) {
|
||||
DeletePermissionSelected();
|
||||
// function : <CookieViewer.js>::loadCookies();
|
||||
// purpose : loads the list of cookies into the cookie list treeview
|
||||
function loadCookies()
|
||||
{
|
||||
// get cookies into an array
|
||||
list = cookieviewer.GetCookieValue();
|
||||
BREAK = list[0];
|
||||
cookieList = list.split(BREAK);
|
||||
CreateCookieList(); // builds an object array from cookiestream
|
||||
for(i = 0; i < cookies.length; i++)
|
||||
{
|
||||
var domain = cookies[i].domain;
|
||||
if(domain.charAt(0) == ".") // get rid of the ugly dot on the start of some domains
|
||||
domain = domain.substring(1,domain.length);
|
||||
AddItem("cookielist", [domain,cookies[i].name], "tree_", cookies[i].number);
|
||||
}
|
||||
}
|
||||
|
||||
// function : <CookieViewer.js>::ViewSelectedCookie();
|
||||
// purpose : displays information about the selected cookie in the info fieldset
|
||||
function ViewCookieSelected(node)
|
||||
{
|
||||
var cookietree = document.getElementById("cookietree");
|
||||
if(cookietree.nodeName != "tree")
|
||||
return false;
|
||||
if(cookietree.selectedItems.length > 1)
|
||||
return false;
|
||||
cookie = node;
|
||||
if(cookie.getAttribute("id").indexOf("tree_") == -1)
|
||||
return false;
|
||||
var idx = parseInt(cookie.getAttribute("id").substring(5,cookie.getAttribute("id").length));
|
||||
var props = [cookies[idx].number, cookies[idx].name, cookies[idx].value,
|
||||
cookies[idx].domaintype, cookies[idx].domain, cookies[idx].path,
|
||||
cookies[idx].secure, cookies[idx].expire];
|
||||
|
||||
rows =
|
||||
[null,"ifl_name","ifl_value","ifl_domaintype","ifl_domain","ifl_path","ifl_secure","ifl_expires"];
|
||||
for(i = 1; i < props.length; i++)
|
||||
{
|
||||
if(i == 3) {
|
||||
var dtypecell = document.getElementById("ifl_domaintype");
|
||||
if(dtypecell.hasChildNodes()) {
|
||||
dtypecell.removeChild(dtypecell.lastChild);
|
||||
}
|
||||
var content = document.createTextNode(cookies[idx].domaintype+":");
|
||||
dtypecell.appendChild(content);
|
||||
continue;
|
||||
}
|
||||
var field = document.getElementById(rows[i]);
|
||||
var content = props[i];
|
||||
field.value = content;
|
||||
if(rows[i] == "ifl_expires") break;
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteCookieSelected() {
|
||||
selname = top.frames[list_frame].document.fSelectCookie.selname;
|
||||
goneC = top.frames[button_frame].document.buttons.goneC;
|
||||
var p;
|
||||
var i;
|
||||
for (i=selname.options.length; i>0; i--) {
|
||||
if (selname.options[i-1].selected) {
|
||||
selname.options[i-1].selected = 0;
|
||||
goneC.value = goneC.value + selname.options[i-1].value + ",";
|
||||
deleted_cookies[selname.options[i-1].value] = 1;
|
||||
selname.remove(i-1);
|
||||
}
|
||||
}
|
||||
top.frames[prop_frame].document.open();
|
||||
top.frames[prop_frame].document.close();
|
||||
}
|
||||
// function : <CookieViewer.js>::DeleteCookieSelected();
|
||||
// purpose : deletes all the cookies that are selected
|
||||
function DeleteCookieSelected() {
|
||||
// delete selected item
|
||||
gone_c += DeleteItemSelected("cookietree", "tree_", "cookielist");
|
||||
// set fields
|
||||
rows = ["ifl_name","ifl_value","ifl_domain","ifl_path","ifl_secure","ifl_expires"];
|
||||
for(k = 0; k < rows.length; k++)
|
||||
{
|
||||
var row = document.getElementById(rows[k]);
|
||||
row.setAttribute("value","");
|
||||
}
|
||||
}
|
||||
|
||||
function DeletePermissionSelected() {
|
||||
selname = top.frames[list_frame].document.fSelectPermission.selname;
|
||||
goneP = top.frames[button_frame].document.buttons.goneP;
|
||||
var p;
|
||||
var i;
|
||||
for (i=selname.options.length; i>0; i--) {
|
||||
if (selname.options[i-1].selected) {
|
||||
selname.options[i-1].selected = 0;
|
||||
goneP.value = goneP.value + selname.options[i-1].value + ",";
|
||||
deleted_permissions[selname.options[i-1].value] = 1;
|
||||
selname.remove(i-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*** =================== PERMISSIONS CODE =================== ***/
|
||||
|
||||
function loadCookies(){
|
||||
cookie_mode = 0;
|
||||
top.frames[index_frame].document.open();
|
||||
top.frames[index_frame].document.write(
|
||||
"<body bgcolor='#c0c0c0'>" +
|
||||
"<table border='0' width='100%'>" +
|
||||
"<tr>" +
|
||||
"<td align='center' valign='middle' bgcolor='#ffffff'>" +
|
||||
"<font size='2' color='#666666'>" +
|
||||
"<b>" + cookiesTab + "</b>" +
|
||||
"</font>" +
|
||||
"</td>" +
|
||||
"<td align='center' valign='middle' bgcolor='#c0c0c0'>" +
|
||||
"<a onclick='top.loadPermissions();' href=''>" +
|
||||
"<font size='2'>" + permissionsTab + "</font>" +
|
||||
"</a>" +
|
||||
"</td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</body>"
|
||||
);
|
||||
top.frames[index_frame].document.close();
|
||||
// function : <CookieViewer.js>::CreatePermissionList();
|
||||
// purpose : creates an array of permission objects from the permission stream
|
||||
function CreatePermissionList()
|
||||
{
|
||||
count = 0;
|
||||
for(i = 1; i < permissionList.length; i+=2)
|
||||
{
|
||||
permissions[count] = new Permission();
|
||||
permissions[count].number = permissionList[i];
|
||||
permStr = permissionList[i+1];
|
||||
permissions[count].type = permStr.substring(0,1);
|
||||
permissions[count].domain = permStr.substring(1,permStr.length);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
top.frames[title_frame].document.open();
|
||||
top.frames[title_frame].document.write
|
||||
(" " + cookiesStored);
|
||||
top.frames[title_frame].document.close();
|
||||
// function : <CookieViewer.js>::Permission();
|
||||
// purpose : an home-brewed object that represents a individual permission in the stream
|
||||
function Permission(number,type,domain)
|
||||
{
|
||||
this.number = (arguments.length) ? number : null;
|
||||
this.type = (arguments.length) ? type : null;
|
||||
this.domain = (arguments.length) ? domain : null;
|
||||
}
|
||||
|
||||
top.frames[prop_frame].document.open();
|
||||
top.frames[prop_frame].document.close();
|
||||
// function : <CookieViewer.js>::loadPermissions();
|
||||
// purpose : loads the list of permissions into the permission list treeview
|
||||
function loadPermissions()
|
||||
{
|
||||
// get permissions into an array
|
||||
list = cookieviewer.GetPermissionValue();
|
||||
BREAK = list[0];
|
||||
permissionList = list.split(BREAK);
|
||||
CreatePermissionList(); // builds an object array from permissionstream
|
||||
for(i = 0; i < permissions.length; i++)
|
||||
{
|
||||
var domain = permissions[i].domain;
|
||||
if(domain.charAt(0) == ".") // get rid of the ugly dot on the start of some domains
|
||||
domain = domain.substring(1,domain.length);
|
||||
if(permissions[i].type == "+")
|
||||
contentStr = bundle.GetStringFromName("can");
|
||||
else if(permissions[i].type == "-")
|
||||
contentStr = bundle.GetStringFromName("cannot");
|
||||
AddItem("permissionslist",[domain,contentStr],"permtree_",permissions[i].number)
|
||||
}
|
||||
}
|
||||
|
||||
loadCookiesList();
|
||||
}
|
||||
/*** =================== GENERAL CODE =================== ***/
|
||||
|
||||
function ViewCookieSelected() {
|
||||
index = 8*(top.frames[list_frame].document.fSelectCookie.selname.selectedIndex) + 1;
|
||||
top.frames[prop_frame].document.open();
|
||||
top.frames[prop_frame].document.write(
|
||||
"<nobr><b>" + name + "</b> " + cookieList[index+1] + "</nobr><br/>" +
|
||||
"<nobr><b>" + value + "</b> " + cookieList[index+2] + "</nobr><br/>" +
|
||||
"<nobr><b>" + cookieList[index+3] + ": </b>" + cookieList[index+4] + "</nobr><br/>" +
|
||||
"<nobr><b>" + path + "</b> " + cookieList[index+5] + "</nobr><br/>" +
|
||||
"<nobr><b>" + secure + "</b> " + cookieList[index+6] + "</nobr><br/>" +
|
||||
"<nobr><b>" + expires + "</b> " + cookieList[index+7] + "</nobr><br/>"
|
||||
);
|
||||
top.frames[prop_frame].document.close();
|
||||
}
|
||||
// function : <CookieViewer.js>::doOKButton();
|
||||
// purpose : saves the changed settings and closes the dialog.
|
||||
function onOK(){
|
||||
var result = "|goneC|" + gone_c + "|goneP|" + gone_p + "|";
|
||||
cookieviewer.SetValue(result, window);
|
||||
return true;
|
||||
}
|
||||
|
||||
function loadCookiesList(){
|
||||
top.frames[list_frame].document.open();
|
||||
top.frames[list_frame].document.write(
|
||||
"<form name='fSelectCookie'>" +
|
||||
"<p>" +
|
||||
"<b>" + Bundle.GetStringFromName("siteCookiename") + " </b>" +
|
||||
"<table border='0'>" +
|
||||
"<tr>" +
|
||||
"<td width='100%' valign='top'>" +
|
||||
"<center>" +
|
||||
"<p>" +
|
||||
"<select name='selname' size='10' multiple='multiple' onchange='top.ViewCookieSelected();'>"
|
||||
);
|
||||
for (i=1; !(i>=cookieList.length); i+=8) {
|
||||
if (!deleted_cookies[cookieList[i]]) {
|
||||
top.frames[list_frame].document.write(
|
||||
"<option value=" + cookieList[i] + ">" +
|
||||
cookieList[i+4] + ":" + cookieList[i+1] +
|
||||
"</option>"
|
||||
);
|
||||
}
|
||||
}
|
||||
top.frames[list_frame].document.write(
|
||||
"</select>" +
|
||||
"</p>" +
|
||||
"</center>" +
|
||||
"</td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</p>" +
|
||||
"</form>"
|
||||
);
|
||||
top.frames[list_frame].document.close();
|
||||
}
|
||||
/*** =================== TREE MANAGEMENT CODE =================== ***/
|
||||
|
||||
function loadPermissions(){
|
||||
cookie_mode = 1;
|
||||
top.frames[index_frame].document.open();
|
||||
top.frames[index_frame].document.write(
|
||||
"<body bgcolor='#c0c0c0'>" +
|
||||
"<table border='0' width='100%'>" +
|
||||
"<tr>" +
|
||||
"<td align='center' valign='middle' bgcolor='#c0c0c0'>" +
|
||||
"<a onclick='top.loadCookies();' href=''>" +
|
||||
"<font size='2'>" + cookiesTab + "</font>" +
|
||||
"</a>" +
|
||||
"</td>" +
|
||||
"<td align='center' valign='middle' bgcolor='#ffffff'>" +
|
||||
"<font size='2' color='#666666'>" +
|
||||
"<b>" + permissionsTab + "</b>" +
|
||||
"</font>" +
|
||||
"</td>" +
|
||||
"<td> </td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</body>"
|
||||
);
|
||||
top.frames[index_frame].document.close();
|
||||
|
||||
top.frames[title_frame].document.open();
|
||||
top.frames[title_frame].document.write
|
||||
(" " + permissionsStored + "");
|
||||
top.frames[title_frame].document.close();
|
||||
|
||||
top.frames[prop_frame].document.open();
|
||||
top.frames[prop_frame].document.close();
|
||||
|
||||
loadPermissionsList();
|
||||
}
|
||||
|
||||
function loadPermissionsList(){
|
||||
top.frames[list_frame].document.open();
|
||||
top.frames[list_frame].document.write(
|
||||
"<form name='fSelectPermission'>" +
|
||||
"<p>" +
|
||||
"<table border='0'>" +
|
||||
"<tr>" +
|
||||
"<td width='100%' valign='top'>" +
|
||||
"<center>" +
|
||||
"<p>" +
|
||||
"<select name='selname' size='10' multiple='multiple'> "
|
||||
);
|
||||
for (i=1; !(i>=permissionList.length); i+=2) {
|
||||
if (!deleted_permissions[permissionList[i]]) {
|
||||
top.frames[list_frame].document.write(
|
||||
"<option value=" + permissionList[i] + ">" +
|
||||
permissionList[i+1] +
|
||||
"</option>"
|
||||
);
|
||||
}
|
||||
}
|
||||
top.frames[list_frame].document.write(
|
||||
"</select>" +
|
||||
"</p>" +
|
||||
"</center>" +
|
||||
"</td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</p>" +
|
||||
"</form>"
|
||||
);
|
||||
top.frames[list_frame].document.close();
|
||||
}
|
||||
|
||||
function loadButtons(){
|
||||
top.frames[button_frame].document.open();
|
||||
top.frames[button_frame].document.write(
|
||||
"<form name='buttons'>" +
|
||||
"<br/>" +
|
||||
" " +
|
||||
"<button onclick='top.DeleteItemSelected();'>" + removeCmdLabel + "</button>" +
|
||||
"<div align='right'>" +
|
||||
"<button onclick='parent.Save();'>" + okCmdLabel + "</button>" +
|
||||
" " +
|
||||
"<button onclick='parent.Cancel();'>" + cancelCmdLabel + "</button>" +
|
||||
"</div>" +
|
||||
"<input type='hidden' name='goneC' value='' size='-1'/>" +
|
||||
"<input type='hidden' name='goneP' value='' size='-1'/>" +
|
||||
"<input type='hidden' name='cookieList' value='' size='-1'/>" +
|
||||
"<input type='hidden' name='permissionList' value='' size='-1'/>" +
|
||||
"</form>"
|
||||
);
|
||||
top.frames[button_frame].document.close();
|
||||
}
|
||||
|
||||
function loadFrames(){
|
||||
|
||||
/*
|
||||
* The cookieList is a sequence of items separated by the BREAK character. These
|
||||
* items are:
|
||||
* empty
|
||||
* number for first cookie
|
||||
* name for first cookie
|
||||
* value for first cookie
|
||||
* domain indicator ("Domain" or "Host") for first cookie
|
||||
* domain or host name for first cookie
|
||||
* path for first cookie
|
||||
* secure indicator ("Yes" or "No") for first cookie
|
||||
* expiration for first cookie
|
||||
* with the eight items above repeated for each successive cookie
|
||||
*/
|
||||
list = DoGetCookieList();
|
||||
BREAK = list[0];
|
||||
cookieList = list.split(BREAK);
|
||||
|
||||
/*
|
||||
* The permissionList is a sequence of items separated by the BREAK character. These
|
||||
* items are:
|
||||
* empty
|
||||
* number for first permission
|
||||
* +/- hostname for first permission
|
||||
* with the above two items repeated for each successive permission
|
||||
*/
|
||||
list = DoGetPermissionList();
|
||||
BREAK = list[0];
|
||||
permissionList = list.split(BREAK);
|
||||
loadCookies();
|
||||
loadButtons();
|
||||
}
|
||||
|
||||
function Save(){
|
||||
var goneC = top.frames[button_frame].document.buttons.goneC;
|
||||
var goneP = top.frames[button_frame].document.buttons.goneP;
|
||||
var result = "|goneC|"+goneC.value+"|goneP|"+goneP.value+"|";
|
||||
DoSave(result);
|
||||
}
|
||||
|
||||
function Cancel(){
|
||||
var result = "|goneC||goneP||";
|
||||
DoSave(result);
|
||||
}
|
||||
// function : <CookieViewer.js>::AddItem();
|
||||
// purpose : utility function for adding items to a tree.
|
||||
function AddItem(children,cells,prefix,idfier)
|
||||
{
|
||||
var kids = document.getElementById(children);
|
||||
var item = document.createElement("treeitem");
|
||||
var row = document.createElement("treerow");
|
||||
for(var i = 0; i < cells.length; i++)
|
||||
{
|
||||
var cell = document.createElement("treecell");
|
||||
var text = document.createTextNode(cells[i]);
|
||||
cell.appendChild(text);
|
||||
row.appendChild(cell);
|
||||
}
|
||||
item.appendChild(row);
|
||||
item.setAttribute("id",prefix + idfier);
|
||||
kids.appendChild(item);
|
||||
}
|
||||
|
||||
// function : <CookieViewer.js>::DeleteItemSelected();
|
||||
// purpose : deletes all the signons that are selected
|
||||
function DeleteItemSelected(tree, prefix, kids) {
|
||||
var delnarray = [];
|
||||
var rv = "";
|
||||
var cookietree = document.getElementById(tree);
|
||||
selitems = cookietree.selectedItems;
|
||||
for(var i = 0; i < selitems.length; i++)
|
||||
{
|
||||
delnarray[i] = document.getElementById(selitems[i].getAttribute("id"));
|
||||
var itemid = parseInt(selitems[i].getAttribute("id").substring(prefix.length,selitems[i].getAttribute("id").length));
|
||||
rv += (itemid + ",");
|
||||
}
|
||||
for(var i = 0; i < delnarray.length; i++)
|
||||
{
|
||||
document.getElementById(kids).removeChild(delnarray[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
|
@ -1,13 +1,24 @@
|
|||
siteCookiename = site:cookie-name
|
||||
cookiesTab = View stored cookies
|
||||
permissionsTab = View sites that can or cannot store cookies
|
||||
cookiesStored = Cookies stored on your system
|
||||
permissionsStored = Sites that can(+) or cannot(-) store cookies
|
||||
name = Name:
|
||||
value = Value:
|
||||
path = Path:
|
||||
secure = Secure:
|
||||
expires = Expires:
|
||||
removeCmdLabel = Remove
|
||||
okCmdLabel = OK
|
||||
cancelCmdLabel = Cancel
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger
|
||||
|
||||
# note this section of the code may require some tinkering in other languages =(
|
||||
# format in dialog: site [can/cannot] set cookies
|
||||
can=site can set cookies
|
||||
cannot=site cannot set cookies
|
||||
domain=Domain for which this cookie applies:
|
||||
host=Server which set the cookie:
|
|
@ -1,62 +1,135 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE window>
|
||||
<xul:window xmlns="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Ben Goodger
|
||||
-->
|
||||
|
||||
<script src="chrome://global/content/strres.js"/>
|
||||
<script src="CookieViewer.js"/>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<?xml-stylesheet href="chrome://wallet/skin/CookieViewer.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<frameset rows = "10,10,125,50" border="0" framespacing="0" onload="loadFrames();">
|
||||
<frame src="about:blank"
|
||||
name="index_frame"
|
||||
scrolling="no"
|
||||
marginwidth="1"
|
||||
marginheight="1"
|
||||
noresize="noresize"/>
|
||||
<frame src="about:blank"
|
||||
name="title_frame"
|
||||
scrolling="no"
|
||||
marginwidth="1"
|
||||
marginheight="1"
|
||||
noresize="noresize"/>
|
||||
<frameset cols="5,*,10,*,5" border="0" framespacing="0">
|
||||
<frame src="about:blank"
|
||||
name="spacer1_frame"
|
||||
scrolling="auto"
|
||||
marginwidth="0"
|
||||
marginheight="0"
|
||||
noresize="noresize"/>
|
||||
<frame src="about:blank"
|
||||
name="list_frame"
|
||||
scrolling="auto"
|
||||
marginwidth="0"
|
||||
marginheight="0"
|
||||
noresize="noresize"/>
|
||||
<frame src="about:blank"
|
||||
name="spacer2_frame"
|
||||
scrolling="auto"
|
||||
marginwidth="0"
|
||||
marginheight="0"
|
||||
noresize="noresize"/>
|
||||
<frame src="about:blank"
|
||||
name="prop_frame"
|
||||
scrolling="auto"
|
||||
marginwidth="0"
|
||||
marginheight="0"
|
||||
noresize="noresize"/>
|
||||
<frame src="about:blank"
|
||||
name="spacer3_frame"
|
||||
scrolling="auto"
|
||||
marginwidth="0"
|
||||
marginheight="0"
|
||||
noresize="noresize"/>
|
||||
</frameset>
|
||||
<frame src="about:blank"
|
||||
name="button_frame"
|
||||
scrolling="no"
|
||||
marginwidth="1"
|
||||
marginheight="1"
|
||||
noresize="noresize"/>
|
||||
</frameset>
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<!DOCTYPE window SYSTEM "chrome://wallet/locale/CookieViewer.dtd" >
|
||||
|
||||
<window id="cookieviewer"
|
||||
width="400" height="420"
|
||||
title="&windowtitle.label;"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
onload="Startup()">
|
||||
|
||||
<html:script src="CookieViewer.js"/>
|
||||
<html:script language="javascript" src="chrome://global/content/strres.js" />
|
||||
|
||||
<tabcontrol flex="100%" align="vertical">
|
||||
<tabbox>
|
||||
<tab>&tab.cookiesonsystem.label;</tab>
|
||||
<tab>&tab.bannedservers.label;</tab>
|
||||
</tabbox>
|
||||
<tabpanel align="horizontal" style="width: 400px;">
|
||||
<box class="tabpanel" id="system" flex="100%" align="vertical">
|
||||
<box><html:div>&div.cookiesonsystem.label;</html:div></box>
|
||||
<spring style="height: 10px;"/>
|
||||
<html:div style="width: 380px;">
|
||||
<tree id="cookietree" style="height: 150px; width: 380px;" align="vertical" onclick="ViewCookieSelected(event.target.parentNode.parentNode)">
|
||||
<treecol width="30%"/>
|
||||
<treecol width="70%"/>
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell>&treehead.cookiedomain.label;</treecell>
|
||||
<treecell>&treehead.cookiename.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren id="cookielist"/>
|
||||
</tree>
|
||||
</html:div>
|
||||
<spring style="height: 5px;"/>
|
||||
<html:fieldset style="border: 2px groove #CCCCDD;">
|
||||
<html:legend>&treehead.infoselected.label;</html:legend>
|
||||
<!-- labels -->
|
||||
<html:div flex="100%">
|
||||
<html:table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<html:tr>
|
||||
<html:td width="55%">&props.name.label;</html:td>
|
||||
<html:td><html:input id="ifl_name" readonly="true" type="text" flex="100%" class="dispcell"/></html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.value.label;</html:td>
|
||||
<html:td><html:input id="ifl_value" readonly="true" type="text" flex="100%" class="dispcell"/></html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td id="ifl_domaintype">&props.domain.label;</html:td>
|
||||
<html:td><html:input id="ifl_domain" readonly="true" type="text" flex="100%" class="dispcell"/></html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.path.label;</html:td>
|
||||
<html:td><html:input id="ifl_path" readonly="true" type="text" flex="100%" class="dispcell"/></html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.secure.label;</html:td>
|
||||
<html:td><html:input id="ifl_secure" readonly="true" type="text" flex="100%" class="dispcell"/></html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.expires.label;</html:td>
|
||||
<html:td><html:input id="ifl_expires" readonly="true" type="text" flex="100%" class="dispcell"/></html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:div>
|
||||
</html:fieldset>
|
||||
<spring flex="5%"/>
|
||||
<box align="horizontal">
|
||||
<titledbutton value="&button.removecookie.label;" onclick="DeleteCookieSelected();"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<box class="tabpanel" id="servers" flex="100%" align="vertical">
|
||||
<html:div>&div.bannedservers.label;</html:div>
|
||||
<spring flex="5%"/>
|
||||
<html:div flex="100%">
|
||||
<tree id="permissionstree" style="height: 280px; width: 380px;" align="vertical">
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell>&treehead.sitename.label;</treecell>
|
||||
<treecell>&treehead.status.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren id="permissionslist"/>
|
||||
</tree>
|
||||
</html:div>
|
||||
<spring style="height: 5px;"/>
|
||||
<box align="horizontal">
|
||||
<titledbutton value="&removepermission.label;" onclick="gone_p += DeleteItemSelected('permissionstree', 'permtree_', 'permissionslist');"/>
|
||||
</box>
|
||||
<spring style="height: 5px;"/>
|
||||
</box>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
|
||||
<!-- from dialogOverlay.xul -->
|
||||
<box align="horizontal">
|
||||
<spring flex="100%"/>
|
||||
<box id="okCancelButtons"/>
|
||||
</box>
|
||||
|
||||
</window>
|
||||
|
||||
</xul:window>
|
||||
|
|
|
@ -175,22 +175,6 @@ static void DOMWindowToWebShellWindow(
|
|||
NS_IMETHODIMP
|
||||
CookieViewerImpl::SetValue(const char* aValue, nsIDOMWindow* win)
|
||||
{
|
||||
/* close the window */
|
||||
if (!win) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsIDOMWindow* top;
|
||||
win->GetTop(&top);
|
||||
if (!top) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(top, &parent);
|
||||
if (parent) {
|
||||
parent->Close();
|
||||
}
|
||||
NS_IF_RELEASE(win);
|
||||
|
||||
/* process the value */
|
||||
NS_PRECONDITION(aValue != nsnull, "null ptr");
|
||||
if (! aValue) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче