gecko/layout/html/tests/block/bugs/9601.html

369 lines
11 KiB
HTML

<HTML>
<HEAD>
<TITLE>Cookies</TITLE>
<SCRIPT>
/* for xpconnect */
// var cookieviewer =
// Components.classes
// ["@mozilla.org/cookieviewer/cookieviewer-world;1"].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>View stored cookies</B>" +
"</FONT>" +
"</TD>" +
"<TD ALIGN=CENTER VALIGN=MIDDLE BGCOLOR=#C0C0C0>" +
"<A ONCLICK=top.loadPermissions(); HREF= >" +
"<FONT SIZE=2>View sites that can or cannot store cookies</FONT>" +
"</A>" +
"</TD>" +
"</TR>" +
"</TABLE>" +
"</BODY>"
);
top.frames[index_frame].document.close();
top.frames[title_frame].document.open();
top.frames[title_frame].document.write
("&nbsp;Cookies stored on your system");
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>" +
"<TABLE BORDER=0 WIDTH=100%HEIGHT=95%>" +
"<TR>" +
"<TD WIDTH=100%VALIGN=TOP>" +
"<CENTER>" +
"<P>" +
"<SELECT " +
"NAME=selname " +
"SIZE=15 " +
"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>" +
"</CENTER>" +
"</TD>" +
"</TR>" +
"</TABLE>" +
"</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>View stored cookies</FONT>" +
"</A>" +
"</TD>" +
"<TD ALIGN=CENTER VALIGN=MIDDLE BGCOLOR=#FFFFFF>" +
"<FONT SIZE=2 COLOR=#666666>" +
"<B>View sites that can or cannot store cookies</B>" +
"</FONT>" +
"</TD>" +
"<TD>&nbsp;&nbsp;&nbsp;</TD>" +
"</TR>" +
"</TABLE>" +
"</BODY>"
);
top.frames[index_frame].document.close();
top.frames[title_frame].document.open();
top.frames[title_frame].document.write
("&nbsp;Sites that can(+) or cannot(-) store cookies");
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 WIDTH=100%HEIGHT=95%>" +
"<TR>" +
"<TD WIDTH=100%VALIGN=TOP>" +
"<CENTER>" +
"<P>" +
"<SELECT NAME=selname SIZE=15 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>" +
"</CENTER>" +
"</TD>" +
"</TR>" +
"</TABLE>" +
"</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>" +
"&nbsp;" +
"<INPUT type=BUTTON " +
"value=Remove " +
"onclick=top.DeleteItemSelected();>" +
"<DIV align=right>" +
"<INPUT type=BUTTON value=OK width=80 onclick=parent.Save()>" +
" &nbsp;&nbsp;" +
"<INPUT type=BUTTON value=Cancel width=80 onclick=parent.Cancel()>" +
"</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 = [0,0,0];
/*
* 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 = [0,0,0];
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);
}
</SCRIPT>
</HEAD>
<FRAMESET ROWS = 25,25,*,75
BORDER=0
FRAMESPACING=0
onLoad=loadFrames()>
<FRAME SRC=about:blank
NAME=index_frame
SCROLLING=NO
MARGINWIDTH=1
MARGINHEIGHT=1
NORESIZE>
<FRAME SRC=about:blank
NAME=title_frame
SCROLLING=NO
MARGINWIDTH=1
MARGINHEIGHT=1
NORESIZE>
<FRAMESET COLS=5,*,10,*,5
BORDER=0
FRAMESPACING=0>
<FRAME SRC=about:blank
NAME=spacer1_frame
SCROLLING=AUTO
MARGINWIDTH=0
MARGINHEIGHT=0
NORESIZE>
<FRAME SRC=about:blank
NAME=list_frame
SCROLLING=AUTO
MARGINWIDTH=0
MARGINHEIGHT=0
NORESIZE>
<FRAME SRC=about:blank
NAME=spacer2_frame
SCROLLING=AUTO
MARGINWIDTH=0
MARGINHEIGHT=0
NORESIZE>
<FRAME SRC=about:blank
NAME=prop_frame
SCROLLING=AUTO
MARGINWIDTH=0
MARGINHEIGHT=0
NORESIZE>
<FRAME SRC=about:blank
NAME=spacer3_frame
SCROLLING=AUTO
MARGINWIDTH=0
MARGINHEIGHT=0
NORESIZE>
</FRAMESET>
<FRAME SRC=about:blank
NAME=button_frame
SCROLLING=NO
MARGINWIDTH=1
MARGINHEIGHT=1
NORESIZE>
</FRAMESET>
<NOFRAMES>
<BODY> <P> </BODY>
</NOFRAMES>
</HTML>