зеркало из https://github.com/mozilla/pjs.git
new cookie viewer from Ben Goodger
This commit is contained in:
Родитель
0e7b06253d
Коммит
29d26c0497
|
@ -1310,10 +1310,10 @@ sub MakeResourceAliases()
|
|||
_InstallResources(":mozilla:xpfe:components:xfer:resources:locale:MANIFEST", "$global_chrome_dir:locale");
|
||||
# the WALLET
|
||||
my($wallet_chrome_dir) = "$chrome_dir" . "Wallet";
|
||||
_InstallResources(":mozilla:extensions:wallet:cookieviewer:MANIFEST", "$wallet_chrome_dir:content:default", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:signonviewer:MANIFEST", "$wallet_chrome_dir:content:default", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:walletpreview:MANIFEST", "$wallet_chrome_dir:content:default", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:editor:MANIFEST", "$wallet_chrome_dir:content:default", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:cookieviewer:MANIFEST", "$wallet_chrome_dir:content:default:", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:signonviewer:MANIFEST", "$wallet_chrome_dir:content:default:", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:walletpreview:MANIFEST", "$wallet_chrome_dir:content:default:", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:editor:MANIFEST", "$wallet_chrome_dir:content:default:", 0);
|
||||
|
||||
_InstallResources(":mozilla:extensions:wallet:cookieviewer:MANIFEST_PROPERTIES", "$wallet_chrome_dir:locale:en-US:", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:signonviewer:MANIFEST_PROPERTIES", "$wallet_chrome_dir:locale:en-US:", 0);
|
||||
|
@ -1321,6 +1321,8 @@ sub MakeResourceAliases()
|
|||
_InstallResources(":mozilla:extensions:wallet:editor:MANIFEST_PROPERTIES", "$wallet_chrome_dir:locale:en-US:", 0);
|
||||
_InstallResources(":mozilla:extensions:wallet:src:MANIFEST_PROPERTIES", "$wallet_chrome_dir:locale:en-US:", 0);
|
||||
|
||||
_InstallResources(":mozilla:extensions:wallet:cookieviewer:MANIFEST_SKIN", "$wallet_chrome_dir:skin:default:", 0);
|
||||
|
||||
{
|
||||
my($pref_chrome_dir) = "$chrome_dir" . "Pref";
|
||||
_InstallResources(":mozilla:xpfe:components:prefwindow:resources:content:MANIFEST", "$pref_chrome_dir:content:default:", 0);
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
window {
|
||||
min-width: 400px;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
box.tabpanel {
|
||||
border: 1px outset #CCCCDD;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
tab {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
treehead > treerow > treecell {
|
||||
border: 1px outset #CCCCDD;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
background-color: #CCCCDD;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
treechildren > treeitem > treerow > treecell {
|
||||
border-right: 1px solid #CCCCDD;
|
||||
border-bottom: 1px solid #CCCCDD;
|
||||
color: inherit;
|
||||
padding-left: 10px;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
treechildren > treeitem > treerow > treecell.fieldcell {
|
||||
border-right: 1px solid #CCCCDD;
|
||||
border-bottom: 1px solid #CCCCDD;
|
||||
color: inherit;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
|
||||
treechildren > treeitem > treerow [selectedrow ~= false] {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
treechildren > treeitem > treerow [selectedrow ~= true] {
|
||||
background-color: #666699;
|
||||
color: white;
|
||||
}
|
||||
|
||||
tree#infotree treechildren > treeitem > treerow [selectedrow ~= false] {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
tree#infotree treechildren > treeitem > treerow [selectedrow ~= true] {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
tree {
|
||||
border: 1px inset #CCCCDD;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0000FF;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #FF0000;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
tree treechildren > treeitem > treerow[selectedrow=true] > treecell > a:link {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
tree treechildren > treeitem > treerow[selectedrow ~= true] > treecell > a:hover {
|
||||
color: #FFFFFF;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!ENTITY tab.cookiesonsystem.label "Stored Cookies">
|
||||
<!ENTITY tab.bannedservers.label "Website Setup">
|
||||
<!ENTITY div.bannedservers.label "Select Internet websites 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 "Cookie Domain">
|
||||
<!ENTITY treehead.infoselected.label "Information about the selected Cookie">
|
||||
<!ENTITY button.removecookie.label "Remove Cookie">
|
||||
|
||||
<!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.path.label "Path:">
|
||||
<!ENTITY props.secure.label "Is Cookie secure?">
|
||||
<!ENTITY props.expires.label "Cookie will expire on:">
|
||||
|
||||
<!ENTITY treehead.sitename.label "Domain Name">
|
||||
<!ENTITY treehead.status.label "Status">
|
||||
<!ENTITY windowtitle.label "Cookie Manager">
|
||||
|
||||
<!ENTITY addpermission.label "New Site">
|
||||
<!ENTITY removepermission.label "Remove Site">
|
||||
|
||||
<!ENTITY canSet.label "can set cookies">
|
||||
<!ENTITY cannotSet.label "cannot set cookies">
|
|
@ -1,270 +1,35 @@
|
|||
/* 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);
|
||||
|
||||
function DoGetCookieList()
|
||||
{
|
||||
return cookieviewer.GetCookieValue();
|
||||
}
|
||||
|
||||
function DoGetPermissionList()
|
||||
{
|
||||
return cookieviewer.GetPermissionValue();
|
||||
}
|
||||
|
||||
function DoSave(value)
|
||||
{
|
||||
cookieviewer.SetValue(value, window);
|
||||
}
|
||||
/* end of xpconnect stuff */
|
||||
|
||||
index_frame = 0;
|
||||
title_frame = 1;
|
||||
spacer1_frame = 2;
|
||||
list_frame = 3;
|
||||
spacer2_frame = 4;
|
||||
prop_frame = 5;
|
||||
spacer3_frame = 6;
|
||||
button_frame = 7;
|
||||
|
||||
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 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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
top.frames[title_frame].document.open();
|
||||
top.frames[title_frame].document.write
|
||||
(" " + cookiesStored);
|
||||
top.frames[title_frame].document.close();
|
||||
|
||||
top.frames[prop_frame].document.open();
|
||||
top.frames[prop_frame].document.close();
|
||||
|
||||
loadCookiesList();
|
||||
}
|
||||
|
||||
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 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();
|
||||
}
|
||||
|
||||
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(){
|
||||
/* Author's Notes:
|
||||
* This is a new CookieViewer.js file. It contains functions for the
|
||||
* presentation of cookie information in the Cookie Viewer dialog. All dialog
|
||||
* updating is performed using DOM calls. Localizable strings are stored in
|
||||
* applicable .dtd and .properties files, style settings in .css and document
|
||||
* structure in .xul.
|
||||
*
|
||||
* - Ben Goodger (14/09/1999)
|
||||
*/
|
||||
|
||||
/*
|
||||
* The cookieList is a sequence of items separated by the BREAK character. These
|
||||
|
@ -280,34 +45,268 @@
|
|||
* expiration for first cookie
|
||||
* with the eight items above repeated for each successive cookie
|
||||
*/
|
||||
list = DoGetCookieList();
|
||||
|
||||
// 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);
|
||||
|
||||
// get cookies into an array
|
||||
list = cookieviewer.GetCookieValue();
|
||||
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();
|
||||
// get permissions into an array
|
||||
list = cookieviewer.GetPermissionValue();
|
||||
BREAK = list[0];
|
||||
permissionList = list.split(BREAK);
|
||||
|
||||
loadCookies();
|
||||
loadButtons();
|
||||
loadPermissions();
|
||||
doSetOKCancel(OKHandler, null);
|
||||
}
|
||||
|
||||
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);
|
||||
/*** =================== COOKIES CODE =================== ***/
|
||||
|
||||
// function : <CookieViewer.js>::CreateCookieList();
|
||||
// purpose : creates an array of cookie objects from the cookie stream
|
||||
function CreateCookieList()
|
||||
{
|
||||
count = 0;
|
||||
for(i = 0; i < cookieList.length; i+=8)
|
||||
{
|
||||
cookies[count] = new Cookie();
|
||||
cookies[count].number = cookieList[i+1];
|
||||
cookies[count].name = cookieList[i+2];
|
||||
cookies[count].value = cookieList[i+3];
|
||||
cookies[count].domaintype = cookieList[i+4];
|
||||
cookies[count].domain = cookieList[i+5];
|
||||
cookies[count].path = cookieList[i+6];
|
||||
cookies[count].secure = cookieList[i+7];
|
||||
cookies[count].expire = cookieList[i];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
function Cancel(){
|
||||
var result = "|goneC||goneP||";
|
||||
DoSave(result);
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
// function : <CookieViewer.js>::loadCookies();
|
||||
// purpose : loads the list of cookies into the cookie list treeview
|
||||
function loadCookies()
|
||||
{
|
||||
CreateCookieList(); // builds an object array from cookiestream
|
||||
var cookielist = document.getElementById("cookielist");
|
||||
for(i = 1; i < cookies.length-1; i++)
|
||||
{
|
||||
var item = document.createElement("treeitem");
|
||||
var row = document.createElement("treerow");
|
||||
var cell = document.createElement("treecell");
|
||||
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);
|
||||
var text = document.createTextNode(domain);
|
||||
cell.appendChild(text);
|
||||
row.appendChild(cell);
|
||||
var cell = document.createElement("treecell");
|
||||
var text = document.createTextNode(cookies[i].name);
|
||||
cell.appendChild(text);
|
||||
row.appendChild(cell);
|
||||
item.appendChild(row);
|
||||
item.setAttribute("id","tree_" + i);
|
||||
cookielist.appendChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
if(cookies[idx].domaintype == "Domain")
|
||||
var contentStr = bundle.GetStringFromName("domain");
|
||||
else
|
||||
var contentStr = bundle.GetStringFromName("host");
|
||||
var content = document.createTextNode(contentStr);
|
||||
dtypecell.appendChild(content);
|
||||
continue;
|
||||
}
|
||||
var row = document.getElementById(rows[i]);
|
||||
if(row.hasChildNodes())
|
||||
row.removeChild(row.lastChild);
|
||||
// TODO: put the actual values into borderless TEXT FIELDS so they don't overrun
|
||||
// and so that their values can be copied.
|
||||
var cell = document.createElement("html:td");
|
||||
var content = props[i];
|
||||
var text = document.createTextNode(content);
|
||||
cell.appendChild(text);
|
||||
row.appendChild(cell);
|
||||
if(rows[i] == "ifl_expires") break;
|
||||
}
|
||||
}
|
||||
|
||||
// function : <CookieViewer.js>::DeleteCookieSelected();
|
||||
// purpose : deletes all the cookies that are selected
|
||||
function DeleteCookieSelected() {
|
||||
var cookietree = document.getElementById("cookietree");
|
||||
selitems = cookietree.selectedItems;
|
||||
|
||||
for(i = 0; i < selitems.length; i++)
|
||||
{
|
||||
var itemid = parseInt(selitems[i].getAttribute("id").substring(5,selitems[i].getAttribute("id").length));
|
||||
// do we need this now? : deleted_cookies[itemid] = 1;
|
||||
gone_c += (itemid + ","); // compatibility with old version and with interface
|
||||
document.getElementById("cookielist").removeChild(selitems[i]);
|
||||
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.removeChild(row.lastChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*** =================== PERMISSIONS CODE =================== ***/
|
||||
|
||||
// function : <CookieViewer.js>::CreatePermissionList();
|
||||
// purpose : creates an array of permission objects from the permission stream
|
||||
function CreatePermissionList()
|
||||
{
|
||||
count = 0;
|
||||
for(i = 0; 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++;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// function : <CookieViewer.js>::loadPermissions();
|
||||
// purpose : loads the list of permissions into the permission list treeview
|
||||
function loadPermissions()
|
||||
{
|
||||
CreatePermissionList(); // builds an object array from permissionstream
|
||||
var permissionlist = document.getElementById("permissionslist");
|
||||
for(i = 0; i < permissions.length; i++)
|
||||
{
|
||||
var item = document.createElement("treeitem");
|
||||
var row = document.createElement("treerow");
|
||||
// create permission domain cell
|
||||
var cell = document.createElement("treecell");
|
||||
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);
|
||||
var text = document.createTextNode(domain);
|
||||
cell.appendChild(text);
|
||||
row.appendChild(cell);
|
||||
// create permission status cell
|
||||
var cell = document.createElement("treecell");
|
||||
// TODO: (possibly) allow user to edit +/- settings
|
||||
if(permissions[i].type == "+")
|
||||
contentStr = bundle.GetStringFromName("can");
|
||||
else if(permissions[i].type == "-")
|
||||
contentStr = bundle.GetStringFromName("cannot");
|
||||
contentStr = document.createTextNode(contentStr);
|
||||
var content = document.createTextNode(contentStr);
|
||||
cell.appendChild(contentStr);
|
||||
|
||||
row.appendChild(cell);
|
||||
item.appendChild(row);
|
||||
item.setAttribute("id","permtree_" + i);
|
||||
permissionlist.appendChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
// function : <CookieViewer.js>::DeletePermissionSelected();
|
||||
// purpose : deletes all the permissions that are selected
|
||||
function DeletePermissionSelected() {
|
||||
var permissiontree = document.getElementById("permissionstree");
|
||||
selitems = permissiontree.selectedItems;
|
||||
|
||||
for(i = 0; i < selitems.length; i++)
|
||||
{
|
||||
var id = selitems[i].getAttribute("id");
|
||||
var itemid = parseInt(id.substring(9,id.length));
|
||||
// do we need this now? : deleted_permissions[itemid] = 1;
|
||||
gone_p += (itemid + ","); // compatibility with old version and with interface
|
||||
document.getElementById("permissionslist").removeChild(selitems[i]);
|
||||
}
|
||||
// dump("gone_c: " + gone_c + "\n"); // useful for debugging
|
||||
// dump("gone_p: " + gone_p + "\n");
|
||||
}
|
||||
|
||||
/*** =================== GENERAL CODE =================== ***/
|
||||
|
||||
// function : <CookieViewer.js>::doOKButton();
|
||||
// purpose : saves the changed settings and closes the dialog.
|
||||
function OKHandler(){
|
||||
var result = "|goneC|" + gone_c + "|goneP|" + gone_p + "|";
|
||||
cookieviewer.SetValue(result, window);
|
||||
self.close();
|
||||
}
|
|
@ -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,140 @@
|
|||
<?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/
|
||||
|
||||
<script src="chrome://global/content/strres.js"/>
|
||||
<script src="CookieViewer.js"/>
|
||||
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.
|
||||
|
||||
<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>
|
||||
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
|
||||
-->
|
||||
|
||||
<?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"?>
|
||||
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<!DOCTYPE window SYSTEM "chrome://wallet/locale/CookieViewer.dtd" >
|
||||
|
||||
<window id="cookieviewer"
|
||||
width="400" height="400"
|
||||
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" flex="100%">
|
||||
<box class="tabpanel" id="system" flex="100%" align="vertical">
|
||||
<box><html:div>&div.cookiesonsystem.label;</html:div></box>
|
||||
<spring style="height: 10px;"/>
|
||||
<tree id="cookietree" flex="100%" style="height: 150px;" 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>
|
||||
<spring style="height: 5px;"/>
|
||||
<html:fieldset style="border: 2px groove #CCCCDD;">
|
||||
<html:legend>&treehead.infoselected.label;</html:legend>
|
||||
<box align="horizontal">
|
||||
<!-- labels -->
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>&props.name.label;</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.value.label;</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.domain.label;</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.path.label;</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.secure.label;</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>&props.expires.label;</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<!-- values -->
|
||||
<html:table>
|
||||
<html:tr id="ifl_name"/>
|
||||
<html:tr id="ifl_value"/>
|
||||
<html:tr id="ifl_domain"/>
|
||||
<html:tr id="ifl_path"/>
|
||||
<html:tr id="ifl_secure"/>
|
||||
<html:tr id="ifl_expires"/>
|
||||
</html:table>
|
||||
</box>
|
||||
</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%"/>
|
||||
<tree id="permissionstree" flex="100%" style="height: 150px;" align="vertical">
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell>&treehead.sitename.label;</treecell>
|
||||
<treecell>&treehead.status.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren id="permissionslist"/>
|
||||
</tree>
|
||||
<spring style="height: 5px;"/>
|
||||
<box align="horizontal">
|
||||
<titledbutton value="&removepermission.label;" onclick="DeletePermissionSelected();"/>
|
||||
</box>
|
||||
<spring style="height: 5px;"/>
|
||||
</box>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
|
||||
<!-- from dialogOverlay.xul -->
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
<popup id="cancannot">
|
||||
<menu>
|
||||
<menupopup>
|
||||
<menuitem value="&canSet.label;"/>
|
||||
<menuitem value="*cannotSet.label;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</popup>
|
||||
|
||||
</window>
|
||||
|
||||
</xul:window>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
CookieViewer.properties
|
|
@ -0,0 +1 @@
|
|||
CookieViewer.css
|
|
@ -40,5 +40,6 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
install:: $(TARGETS)
|
||||
$(INSTALL) $(srcdir)/CookieViewer.xul $(srcdir)/CookieViewer.js $(DIST)/bin/chrome/wallet/content/default
|
||||
$(INSTALL) $(srcdir)/CookieViewer.properties $(DIST)/bin/chrome/wallet/locale/en-US
|
||||
$(INSTALL) $(srcdir)/CookieViewer.properties $(srcdir)/CookieViewer.dtd $(DIST)/bin/chrome/wallet/locale/en-US
|
||||
$(INSTALL) $(srcdir)/CookieViewer.css $(DIST)/bin/chrome/wallet/skin/default
|
||||
|
||||
|
|
|
@ -51,9 +51,13 @@ clobber::
|
|||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
rm -f $(DIST)\bin\chrome\wallet\content\default\CookieViewer.xul
|
||||
rm -f $(DIST)\bin\chrome\wallet\content\default\CookieViewer.js
|
||||
rm -f $(DIST)\bin\chrome\wallet\skin\default\CookieViewer.css
|
||||
rm -f $(DIST)\bin\chrome\wallet\locale\en-US\CookieViewer.properties
|
||||
rm -f $(DIST)\bin\chrome\wallet\locale\en-US\CookieViewer.dtd
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) CookieViewer.xul $(DIST)\bin\chrome\wallet\content\default
|
||||
$(MAKE_INSTALL) CookieViewer.js $(DIST)\bin\chrome\wallet\content\default
|
||||
$(MAKE_INSTALL) CookieViewer.css $(DIST)\bin\chrome\wallet\skin\default
|
||||
$(MAKE_INSTALL) CookieViewer.properties $(DIST)\bin\chrome\wallet\locale\en-US
|
||||
$(MAKE_INSTALL) CookieViewer.dtd $(DIST)\bin\chrome\wallet\locale\en-US
|
||||
|
|
Загрузка…
Ссылка в новой задаче