зеркало из https://github.com/mozilla/pjs.git
reimplement cookie viewer
This commit is contained in:
Родитель
f0bf0952ce
Коммит
4080fe81f1
|
@ -0,0 +1,351 @@
|
||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>Cookies</TITLE>
|
||||||
|
<SCRIPT language="javascript" src="CookieWindow.js"></SCRIPT>
|
||||||
|
<SCRIPT>
|
||||||
|
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;
|
||||||
|
for (j=i ; j<selname.options.length ; j++) {
|
||||||
|
selname.options[j-1] = selname.options[j];
|
||||||
|
}
|
||||||
|
selname.options[selname.options.length-1] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
top.loadCookiesList(); /* not needed in 4.5 */
|
||||||
|
|
||||||
|
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;
|
||||||
|
for (j=i; j < selname.options.length; j++) {
|
||||||
|
selname.options[j-1] = selname.options[j];
|
||||||
|
}
|
||||||
|
selname.options[selname.options.length-1] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
top.loadPermissionsList(); /* not needed in 4.5 */
|
||||||
|
}
|
||||||
|
|
||||||
|
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 HREF=javascript:top.loadPermissions();>" +
|
||||||
|
"<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
|
||||||
|
(" 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 HREF=javascript:top.loadCookies();>" +
|
||||||
|
"<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> </TD>" +
|
||||||
|
"</TR>" +
|
||||||
|
"</TABLE>" +
|
||||||
|
"</BODY>"
|
||||||
|
);
|
||||||
|
top.frames[index_frame].document.close();
|
||||||
|
|
||||||
|
top.frames[title_frame].document.open();
|
||||||
|
top.frames[title_frame].document.write
|
||||||
|
(" 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>" +
|
||||||
|
" " +
|
||||||
|
"<INPUT type=BUTTON " +
|
||||||
|
"value=Remove " +
|
||||||
|
"onclick=top.DeleteItemSelected();>" +
|
||||||
|
"<DIV align=right>" +
|
||||||
|
"<INPUT type=BUTTON value=OK width=80 onclick=parent.Save()>" +
|
||||||
|
" " +
|
||||||
|
"<INPUT type=BUTTON value=Cancel width=80 onclick=parent.DoCancel()>" +
|
||||||
|
"</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(){
|
||||||
|
StartUp("Cookies");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
</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>
|
|
@ -44,4 +44,6 @@ include $(topsrcdir)/config/rules.mk
|
||||||
install::
|
install::
|
||||||
$(INSTALL) $(srcdir)/WalletPreview.html $(DIST)/bin/res/samples
|
$(INSTALL) $(srcdir)/WalletPreview.html $(DIST)/bin/res/samples
|
||||||
$(INSTALL) $(srcdir)/SignonViewer.html $(DIST)/bin/res/samples
|
$(INSTALL) $(srcdir)/SignonViewer.html $(DIST)/bin/res/samples
|
||||||
|
$(INSTALL) $(srcdir)/CookieViewer.html $(DIST)/bin/res/samples
|
||||||
|
$(INSTALL) $(srcdir)/cookie.properties $(DIST)/bin/res
|
||||||
$(INSTALL) $(srcdir)/wallet.properties $(DIST)/bin/res
|
$(INSTALL) $(srcdir)/wallet.properties $(DIST)/bin/res
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
Domain = Domain
|
||||||
|
Host = Host
|
||||||
|
Yes = Yes
|
||||||
|
No = No
|
||||||
|
AtEndOfSession = at end of session
|
||||||
|
PermissionToSetACookie = The site %1$s \nwants permission to set a cookie.
|
||||||
|
PermissionToSetSecondCookie = The site %1$s \nwants permission to set another cookie. You currently have a cookies from this site.
|
||||||
|
PermissionToSetAnotherCookie = The site %1$s \nwants permission to set another cookie. You currently have %2$d cookies from this site.
|
||||||
|
PermissionToModifyCookie = The site %1$s \nwants permission to modify an existing cookie.
|
||||||
|
RememberThisDecision = Remember this decision
|
|
@ -79,4 +79,6 @@ install:: $(DLL)
|
||||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||||
$(MAKE_INSTALL) WalletPreview.html $(DIST)\bin\res\samples
|
$(MAKE_INSTALL) WalletPreview.html $(DIST)\bin\res\samples
|
||||||
$(MAKE_INSTALL) SignonViewer.html $(DIST)\bin\res\samples
|
$(MAKE_INSTALL) SignonViewer.html $(DIST)\bin\res\samples
|
||||||
|
$(MAKE_INSTALL) CookieViewer.html $(DIST)\bin\res\samples
|
||||||
|
$(MAKE_INSTALL) cookie.properties $(DIST)\bin\res
|
||||||
$(MAKE_INSTALL) wallet.properties $(DIST)\bin\res
|
$(MAKE_INSTALL) wallet.properties $(DIST)\bin\res
|
||||||
|
|
|
@ -26,11 +26,6 @@
|
||||||
executed.
|
executed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CookieManagement)
|
|
||||||
/* #define TRUST_LABELS 1 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* make sure we only include this once */
|
/* make sure we only include this once */
|
||||||
#ifndef _NET_PROTO_H_
|
#ifndef _NET_PROTO_H_
|
||||||
#define _NET_PROTO_H_
|
#define _NET_PROTO_H_
|
||||||
|
@ -1060,23 +1055,9 @@ extern void NET_RegisterCookiePrefCallbacks(void);
|
||||||
*/
|
*/
|
||||||
extern int NET_SaveCookies(char *filename);
|
extern int NET_SaveCookies(char *filename);
|
||||||
|
|
||||||
/* Start an anonymous list of cookies */
|
|
||||||
extern void NET_AnonymizeCookies();
|
|
||||||
|
|
||||||
/* Restore original list of cookies */
|
|
||||||
extern void NET_UnanonymizeCookies();
|
|
||||||
|
|
||||||
/* Should referer by supressed for anonymity sake */
|
/* Should referer by supressed for anonymity sake */
|
||||||
extern Bool NET_SupressRefererForAnonymity();
|
extern Bool NET_SupressRefererForAnonymity();
|
||||||
|
|
||||||
#if defined(CookieManagement)
|
|
||||||
extern void NET_DisplayCookieInfoAsHTML(MWContext *context);
|
|
||||||
extern void NET_CookieViewerReturn();
|
|
||||||
extern void NET_DisplayCookieInfoOfSiteAsHTML(MWContext *context, char * URLName);
|
|
||||||
extern int NET_CookiePermission(char* URLName);
|
|
||||||
extern int NET_CookieCount(char * URLName);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SingleSignon)
|
#if defined(SingleSignon)
|
||||||
extern void SI_DisplaySignonInfoAsHTML(MWContext *context);
|
extern void SI_DisplaySignonInfoAsHTML(MWContext *context);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#ifndef nsINetService_h___
|
#ifndef nsINetService_h___
|
||||||
#define nsINetService_h___
|
#define nsINetService_h___
|
||||||
|
|
||||||
|
#include "nsString.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
|
@ -107,22 +108,10 @@ struct nsINetService : public nsISupports
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie)=0;
|
NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie)=0;
|
||||||
|
|
||||||
#ifdef CookieManagement
|
NS_IMETHOD Cookie_DisplayCookieInfoAsHTML()=0;
|
||||||
NS_IMETHOD NET_DisplayCookieInfoAsHTML()=0;
|
NS_IMETHOD Cookie_CookieViewerReturn(nsAutoString results)=0;
|
||||||
#ifndef HTMLDialogs
|
NS_IMETHOD Cookie_GetCookieListForViewer(nsString& aCookieList)=0;
|
||||||
NS_IMETHOD NET_CookieViewerReturn()=0;
|
NS_IMETHOD Cookie_GetPermissionListForViewer(nsString& aPermissionList)=0;
|
||||||
#endif
|
|
||||||
#ifdef PrivacySiteInfo
|
|
||||||
NS_IMETHOD NET_DisplayCookieInfoOfSiteAsHTML(char * URLName)=0;
|
|
||||||
NS_IMETHOD NET_CookiePermission(char* URLName, PRInt32* permission)=0;
|
|
||||||
NS_IMETHOD NET_CookieCount(char* URLName, PRInt32* count)=0;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_IMETHOD NET_AnonymizeCookies()=0;
|
|
||||||
NS_IMETHOD NET_UnanonymizeCookies()=0;
|
|
||||||
NS_IMETHOD SI_AnonymizeSignons()=0;
|
|
||||||
NS_IMETHOD SI_UnanonymizeSignons()=0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the http proxy used for http transactions.
|
* Get the http proxy used for http transactions.
|
||||||
|
|
|
@ -759,72 +759,40 @@ nsNetlibService::SetCookieString(nsIURL *aURL, const nsString& aCookie)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CookieManagement
|
extern void
|
||||||
|
COOKIE_DisplayCookieInfoAsHTML();
|
||||||
|
|
||||||
|
extern void
|
||||||
|
COOKIE_GetCookieListForViewer (nsString& aCookieList);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
COOKIE_GetPermissionListForViewer (nsString& aPermissionList);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
COOKIE_CookieViewerReturn(nsAutoString results);
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNetlibService::NET_DisplayCookieInfoAsHTML(){
|
nsNetlibService::Cookie_DisplayCookieInfoAsHTML(){
|
||||||
::NET_DisplayCookieInfoAsHTML(NULL);
|
::COOKIE_DisplayCookieInfoAsHTML();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HTMLDialogs
|
NS_IMETHODIMP nsNetlibService::Cookie_CookieViewerReturn(nsAutoString results){
|
||||||
NS_IMETHODIMP nsNetlibService::NET_CookieViewerReturn(){
|
::COOKIE_CookieViewerReturn(results);
|
||||||
::NET_CookieViewerReturn();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PrivacySiteInfo
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNetlibService::NET_DisplayCookieInfoOfSiteAsHTML(char * URLName){
|
|
||||||
::NET_DisplayCookieInfoOfSiteAsHTML(NULL, URLName);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNetlibService::NET_CookiePermission(char* URLName, PRInt32* permission){
|
|
||||||
*permission = ::NET_CookiePermission(URLName);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP nsNetlibService::Cookie_GetCookieListForViewer(nsString& aCookieList){
|
||||||
nsNetlibService::NET_CookieCount(char* URLName, PRInt32* count){
|
::COOKIE_GetCookieListForViewer(aCookieList);
|
||||||
*count = ::NET_CookieCount(URLName);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
NS_IMETHODIMP nsNetlibService::Cookie_GetPermissionListForViewer(nsString& aPermissionList){
|
||||||
#endif
|
::COOKIE_GetPermissionListForViewer(aPermissionList);
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNetlibService::NET_AnonymizeCookies(){
|
|
||||||
#ifdef CookieManagement
|
|
||||||
::NET_AnonymizeCookies();
|
|
||||||
#endif
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNetlibService::NET_UnanonymizeCookies(){
|
|
||||||
#ifdef CookieManagement
|
|
||||||
::NET_UnanonymizeCookies();
|
|
||||||
#endif
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNetlibService::SI_AnonymizeSignons(){
|
|
||||||
#ifdef SingleSignon
|
|
||||||
::SI_AnonymizeSignons();
|
|
||||||
#endif
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNetlibService::SI_UnanonymizeSignons(){
|
|
||||||
#ifdef SingleSignon
|
|
||||||
::SI_UnanonymizeSignons();
|
|
||||||
#endif
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNetlibService::GetProxyHTTP(nsString& aProxyHTTP) {
|
nsNetlibService::GetProxyHTTP(nsString& aProxyHTTP) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef nsNetService_h___
|
#ifndef nsNetService_h___
|
||||||
#define nsNetService_h___
|
#define nsNetService_h___
|
||||||
|
|
||||||
|
#include "nsString.h"
|
||||||
#include "nspr.h"
|
#include "nspr.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPref.h"
|
||||||
#include "nsITransport.h"
|
#include "nsITransport.h"
|
||||||
|
@ -53,22 +54,10 @@ public:
|
||||||
NS_IMETHOD GetCookieString(nsIURL *aURL, nsString& aCookie);
|
NS_IMETHOD GetCookieString(nsIURL *aURL, nsString& aCookie);
|
||||||
NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie);
|
NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie);
|
||||||
|
|
||||||
#ifdef CookieManagement
|
NS_IMETHOD Cookie_DisplayCookieInfoAsHTML();
|
||||||
NS_IMETHOD NET_DisplayCookieInfoAsHTML();
|
NS_IMETHOD Cookie_CookieViewerReturn(nsAutoString results);
|
||||||
#ifndef HTMLDialogs
|
NS_IMETHOD Cookie_GetCookieListForViewer(nsString& aCookieList);
|
||||||
NS_IMETHOD NET_CookieViewerReturn();
|
NS_IMETHOD Cookie_GetPermissionListForViewer(nsString& aPermissionList);
|
||||||
#endif
|
|
||||||
#ifdef PrivacySiteInfo
|
|
||||||
NS_IMETHOD NET_DisplayCookieInfoOfSiteAsHTML(char * URLName);
|
|
||||||
NS_IMETHOD NET_CookiePermission(char* URLName, PRInt32* permission);
|
|
||||||
NS_IMETHOD NET_CookieCount(char* URLName, PRInt32* count);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_IMETHOD NET_AnonymizeCookies();
|
|
||||||
NS_IMETHOD NET_UnanonymizeCookies();
|
|
||||||
NS_IMETHOD SI_AnonymizeSignons();
|
|
||||||
NS_IMETHOD SI_UnanonymizeSignons();
|
|
||||||
|
|
||||||
NS_IMETHOD GetProxyHTTP(nsString& aProxyHTTP);
|
NS_IMETHOD GetProxyHTTP(nsString& aProxyHTTP);
|
||||||
NS_IMETHOD SetProxyHTTP(nsString& aProxyHTTP);
|
NS_IMETHOD SetProxyHTTP(nsString& aProxyHTTP);
|
||||||
|
|
|
@ -30,6 +30,10 @@ CSRCS = \
|
||||||
mkaccess.c \
|
mkaccess.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
CPPSRCS = \
|
||||||
|
nsCookie.cpp \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
ifdef MOZ_BRPROF
|
ifdef MOZ_BRPROF
|
||||||
CPPSRCS += nsGetBrowsingProfile.cpp
|
CPPSRCS += nsGetBrowsingProfile.cpp
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -47,6 +47,7 @@ OBJS= \
|
||||||
|
|
||||||
CPP_OBJS= \
|
CPP_OBJS= \
|
||||||
.\$(OBJDIR)\nsGetBrowsingProfile.obj \
|
.\$(OBJDIR)\nsGetBrowsingProfile.obj \
|
||||||
|
.\$(OBJDIR)\nsCookie.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CSRCS = \
|
CSRCS = \
|
||||||
|
@ -56,6 +57,7 @@ CSRCS = \
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
nsGetBrowsingProfile.cpp \
|
nsGetBrowsingProfile.cpp \
|
||||||
|
nsCookie.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LIBRARY_NAME=httpurl
|
LIBRARY_NAME=httpurl
|
||||||
|
@ -89,6 +91,9 @@ LINCS= \
|
||||||
-I$(PUBLIC)\xpcom \
|
-I$(PUBLIC)\xpcom \
|
||||||
-I$(PUBLIC)\brprof \
|
-I$(PUBLIC)\brprof \
|
||||||
-I$(PUBLIC)\raptor \
|
-I$(PUBLIC)\raptor \
|
||||||
|
-I$(PUBLIC)\netlib \
|
||||||
|
-I$(PUBLIC)\intl \
|
||||||
|
-I$(PUBLIC)\locale \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
#!endif
|
#!endif
|
||||||
|
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -641,7 +641,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
|
||||||
kINetServiceIID,
|
kINetServiceIID,
|
||||||
(nsISupports **)&netservice);
|
(nsISupports **)&netservice);
|
||||||
if ((NS_OK == res) && (nsnull != netservice)) {
|
if ((NS_OK == res) && (nsnull != netservice)) {
|
||||||
res = netservice->NET_DisplayCookieInfoAsHTML();
|
res = netservice->Cookie_DisplayCookieInfoAsHTML();
|
||||||
NS_RELEASE(netservice);
|
NS_RELEASE(netservice);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -15,7 +15,6 @@ interface BrowserAppCore : BaseAppCore
|
||||||
void walletChangePassword();
|
void walletChangePassword();
|
||||||
void walletQuickFillin(in Window win);
|
void walletQuickFillin(in Window win);
|
||||||
void walletSamples();
|
void walletSamples();
|
||||||
void cookieViewer();
|
|
||||||
|
|
||||||
void setToolbarWindow(in Window win);
|
void setToolbarWindow(in Window win);
|
||||||
void setContentWindow(in Window win);
|
void setContentWindow(in Window win);
|
||||||
|
|
|
@ -36,6 +36,7 @@ IDLSRCS= \
|
||||||
EditorAppCore.idl \
|
EditorAppCore.idl \
|
||||||
PrefsCore.idl \
|
PrefsCore.idl \
|
||||||
SignonCore.idl \
|
SignonCore.idl \
|
||||||
|
CookieCore.idl \
|
||||||
WalletCore.idl \
|
WalletCore.idl \
|
||||||
RDFCore.idl \
|
RDFCore.idl \
|
||||||
Toolbar.idl \
|
Toolbar.idl \
|
||||||
|
|
|
@ -30,6 +30,7 @@ EXPORTS = \
|
||||||
nsIDOMEditorAppCore.h \
|
nsIDOMEditorAppCore.h \
|
||||||
nsIDOMPrefsCore.h \
|
nsIDOMPrefsCore.h \
|
||||||
nsIDOMSignonCore.h \
|
nsIDOMSignonCore.h \
|
||||||
|
nsIDOMCookieCore.h \
|
||||||
nsIDOMWalletCore.h \
|
nsIDOMWalletCore.h \
|
||||||
nsIDOMProfileCore.h \
|
nsIDOMProfileCore.h \
|
||||||
nsIDOMRDFCore.h \
|
nsIDOMRDFCore.h \
|
||||||
|
|
|
@ -27,6 +27,7 @@ EXPORTS= \
|
||||||
nsIDOMDOMPropsCore.h \
|
nsIDOMDOMPropsCore.h \
|
||||||
nsIDOMPrefsCore.h \
|
nsIDOMPrefsCore.h \
|
||||||
nsIDOMSignonCore.h \
|
nsIDOMSignonCore.h \
|
||||||
|
nsIDOMCookieCore.h \
|
||||||
nsIDOMWalletCore.h \
|
nsIDOMWalletCore.h \
|
||||||
nsIDOMProfileCore.h \
|
nsIDOMProfileCore.h \
|
||||||
nsIDOMRDFCore.h \
|
nsIDOMRDFCore.h \
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
0x96a79e90, 0xe30, 0x11d3, { 0xab, 0x9f, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96} \
|
0x96a79e90, 0xe30, 0x11d3, { 0xab, 0x9f, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NS_COOKIECORE_CID \
|
||||||
|
{ /* {76C2DCD0-191F-11d3-ABA7-0080C787AD96 */ \
|
||||||
|
0x76c2dcd0, 0x191f, 0x11d3, { 0xab, 0xa7, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96} \
|
||||||
|
}
|
||||||
|
|
||||||
#define NS_WALLETCORE_CID \
|
#define NS_WALLETCORE_CID \
|
||||||
{ /* {9D6E2541-108B-11d3-ABA3-0080C787AD96 */ \
|
{ /* {9D6E2541-108B-11d3-ABA3-0080C787AD96 */ \
|
||||||
0x9d6e2541, 0x108b, 0x11d3, { 0xab, 0xa3, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96} \
|
0x9d6e2541, 0x108b, 0x11d3, { 0xab, 0xa3, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96} \
|
||||||
|
|
|
@ -53,8 +53,6 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD WalletSamples()=0;
|
NS_IMETHOD WalletSamples()=0;
|
||||||
|
|
||||||
NS_IMETHOD CookieViewer()=0;
|
|
||||||
|
|
||||||
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin)=0;
|
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin)=0;
|
||||||
|
|
||||||
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin)=0;
|
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin)=0;
|
||||||
|
@ -91,7 +89,6 @@ public:
|
||||||
NS_IMETHOD WalletChangePassword(); \
|
NS_IMETHOD WalletChangePassword(); \
|
||||||
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); \
|
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); \
|
||||||
NS_IMETHOD WalletSamples(); \
|
NS_IMETHOD WalletSamples(); \
|
||||||
NS_IMETHOD CookieViewer(); \
|
|
||||||
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin); \
|
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin); \
|
||||||
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin); \
|
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin); \
|
||||||
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin); \
|
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin); \
|
||||||
|
@ -117,7 +114,6 @@ public:
|
||||||
NS_IMETHOD WalletChangePassword() { return _to WalletChangePassword(); } \
|
NS_IMETHOD WalletChangePassword() { return _to WalletChangePassword(); } \
|
||||||
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin) { return _to WalletQuickFillin(aWin); } \
|
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin) { return _to WalletQuickFillin(aWin); } \
|
||||||
NS_IMETHOD WalletSamples() { return _to WalletSamples(); } \
|
NS_IMETHOD WalletSamples() { return _to WalletSamples(); } \
|
||||||
NS_IMETHOD CookieViewer() { return _to CookieViewer(); } \
|
|
||||||
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin) { return _to SetToolbarWindow(aWin); } \
|
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin) { return _to SetToolbarWindow(aWin); } \
|
||||||
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin) { return _to SetContentWindow(aWin); } \
|
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin) { return _to SetContentWindow(aWin); } \
|
||||||
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin) { return _to SetWebShellWindow(aWin); } \
|
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin) { return _to SetWebShellWindow(aWin); } \
|
||||||
|
|
|
@ -0,0 +1,295 @@
|
||||||
|
/* -*- 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "nsCookieCore.h"
|
||||||
|
#include "nsINetService.h"
|
||||||
|
#include "nsIURL.h"
|
||||||
|
#include "nsIFileLocator.h"
|
||||||
|
#include "nsFileLocations.h"
|
||||||
|
#include "nsFileSpec.h"
|
||||||
|
#include "nsFileStream.h"
|
||||||
|
#include "nsIBrowserWindow.h"
|
||||||
|
#include "nsIWebShell.h"
|
||||||
|
#include "pratom.h"
|
||||||
|
#include "nsIComponentManager.h"
|
||||||
|
#include "nsAppCores.h"
|
||||||
|
#include "nsAppCoresCIDs.h"
|
||||||
|
#include "nsAppShellCIDs.h"
|
||||||
|
#include "nsAppCoresManager.h"
|
||||||
|
#include "nsIAppShellService.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
|
|
||||||
|
#include "nsIScriptGlobalObject.h"
|
||||||
|
|
||||||
|
#include "nsIScriptContext.h"
|
||||||
|
#include "nsIScriptContextOwner.h"
|
||||||
|
#include "nsIDOMWindow.h"
|
||||||
|
#include "nsIWebShellWindow.h"
|
||||||
|
|
||||||
|
#include "plstr.h"
|
||||||
|
#include "prmem.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
|
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
|
||||||
|
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||||
|
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||||
|
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||||
|
|
||||||
|
static void DOMWindowToWebShellWindow(nsIDOMWindow *DOMWindow, nsCOMPtr<nsIWebShellWindow> *webWindow);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
nsCookieCore::nsCookieCore()
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
: mPanelWindow(nsnull)
|
||||||
|
{
|
||||||
|
printf("Created nsCookieCore\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
nsCookieCore::~nsCookieCore()
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
NS_IF_RELEASE(mPanelWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS_INHERITED(nsCookieCore, nsBaseAppCore, nsIDOMCookieCore)
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
NS_PRECONDITION(nsnull != aScriptObject, "null arg");
|
||||||
|
nsresult res = NS_OK;
|
||||||
|
if (nsnull == mScriptObject)
|
||||||
|
{
|
||||||
|
res = NS_NewScriptCookieCore(aContext,
|
||||||
|
(nsISupports *)(nsIDOMCookieCore*)this,
|
||||||
|
nsnull,
|
||||||
|
&mScriptObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
*aScriptObject = mScriptObject;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::Init(const nsString& aId)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
nsresult rv = nsBaseAppCore::Init(aId);
|
||||||
|
return rv;
|
||||||
|
} // nsCookieCore::Init
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::ShowWindow(nsIDOMWindow* aCurrentFrontWin)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
nsINetService *netservice;
|
||||||
|
nsresult res;
|
||||||
|
res = nsServiceManager::GetService(kNetServiceCID,
|
||||||
|
kINetServiceIID,
|
||||||
|
(nsISupports **)&netservice);
|
||||||
|
if ((NS_OK == res) && (nsnull != netservice)) {
|
||||||
|
res = netservice->Cookie_DisplayCookieInfoAsHTML();
|
||||||
|
nsServiceManager::ReleaseService(kNetServiceCID, netservice);
|
||||||
|
}
|
||||||
|
|
||||||
|
// (code adapted from nsToolkitCore::ShowModal. yeesh.)
|
||||||
|
nsresult rv;
|
||||||
|
nsIAppShellService *appShell;
|
||||||
|
nsIWebShellWindow *window;
|
||||||
|
|
||||||
|
window = nsnull;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURL> urlObj;
|
||||||
|
rv = NS_NewURL(getter_AddRefs(urlObj), "resource://res/samples/CookieViewer.html");
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
rv = nsServiceManager::GetService(kAppShellServiceCID, kIAppShellServiceIID,
|
||||||
|
(nsISupports**) &appShell);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
// Create "save to disk" nsIXULCallbacks...
|
||||||
|
//nsIXULWindowCallbacks *cb = new nsFindDialogCallbacks( aURL, aContentType );
|
||||||
|
nsIXULWindowCallbacks *cb = nsnull;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIWebShellWindow> parent;
|
||||||
|
DOMWindowToWebShellWindow(aCurrentFrontWin, &parent);
|
||||||
|
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||||
|
nsnull, cb, 504, 436);
|
||||||
|
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||||
|
|
||||||
|
if (window != nsnull) {
|
||||||
|
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||||
|
nsresult gotParent;
|
||||||
|
gotParent = parent ? parent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||||
|
NS_ERROR_FAILURE;
|
||||||
|
// Windows OS is the only one that needs the parent disabled, or cares
|
||||||
|
// arguably this should be done by the new window, within ShowModal...
|
||||||
|
if (NS_SUCCEEDED(gotParent))
|
||||||
|
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||||
|
window->ShowModal();
|
||||||
|
if (NS_SUCCEEDED(gotParent))
|
||||||
|
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
} // nsCookieCore::ShowWindow
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::ChangePanel(const nsString& aURL)
|
||||||
|
// Start loading of a new cookie panel.
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
NS_ASSERTION(mPanelWindow, "panel window is null");
|
||||||
|
if (!mPanelWindow)
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptGlobalObject> globalScript(do_QueryInterface(mPanelWindow));
|
||||||
|
if (!globalScript)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
nsCOMPtr<nsIWebShell> webshell;
|
||||||
|
globalScript->GetWebShell(getter_AddRefs(webshell));
|
||||||
|
if (!webshell)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
webshell->LoadURL(aURL.GetUnicode());
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::PanelLoaded(nsIDOMWindow* aWin)
|
||||||
|
// Callback after loading of a new cookie panel.
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
// Out with the old!
|
||||||
|
|
||||||
|
if (mPanelWindow != aWin)
|
||||||
|
{
|
||||||
|
NS_IF_RELEASE(mPanelWindow);
|
||||||
|
mPanelWindow = aWin;
|
||||||
|
NS_IF_ADDREF(mPanelWindow);
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
static void DOMWindowToWebShellWindow(
|
||||||
|
nsIDOMWindow *DOMWindow,
|
||||||
|
nsCOMPtr<nsIWebShellWindow> *webWindow)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
if (!DOMWindow)
|
||||||
|
return; // with webWindow unchanged -- its constructor gives it a null ptr
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptGlobalObject> globalScript(do_QueryInterface(DOMWindow));
|
||||||
|
nsCOMPtr<nsIWebShell> webshell, rootWebshell;
|
||||||
|
if (globalScript)
|
||||||
|
globalScript->GetWebShell(getter_AddRefs(webshell));
|
||||||
|
if (webshell)
|
||||||
|
webshell->GetRootWebShellEvenIfChrome(*getter_AddRefs(rootWebshell));
|
||||||
|
if (rootWebshell) {
|
||||||
|
nsCOMPtr<nsIWebShellContainer> webshellContainer;
|
||||||
|
rootWebshell->GetContainer(*getter_AddRefs(webshellContainer));
|
||||||
|
*webWindow = do_QueryInterface(webshellContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
static nsresult Close(nsIDOMWindow*& dw)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
if (!dw)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
nsIDOMWindow* top;
|
||||||
|
dw->GetTop(&top);
|
||||||
|
if (!top)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
nsCOMPtr<nsIWebShellWindow> parent;
|
||||||
|
DOMWindowToWebShellWindow(top, &parent);
|
||||||
|
if (parent)
|
||||||
|
parent->Close();
|
||||||
|
NS_IF_RELEASE(dw);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::SaveCookie(const nsString& results)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
nsINetService *netservice;
|
||||||
|
nsresult res;
|
||||||
|
res = nsServiceManager::GetService(kNetServiceCID,
|
||||||
|
kINetServiceIID,
|
||||||
|
(nsISupports **)&netservice);
|
||||||
|
if ((NS_OK == res) && (nsnull != netservice)) {
|
||||||
|
res = netservice->Cookie_CookieViewerReturn (results);
|
||||||
|
nsServiceManager::ReleaseService(kNetServiceCID, netservice);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Close(mPanelWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::CancelCookie()
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
return Close(mPanelWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::GetCookieList(nsString& aCookieList)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
nsINetService *netservice;
|
||||||
|
nsresult res;
|
||||||
|
res = nsServiceManager::GetService(kNetServiceCID,
|
||||||
|
kINetServiceIID,
|
||||||
|
(nsISupports **)&netservice);
|
||||||
|
if ((NS_OK == res) && (nsnull != netservice)) {
|
||||||
|
res = netservice->Cookie_GetCookieListForViewer(aCookieList);
|
||||||
|
nsServiceManager::ReleaseService(kNetServiceCID, netservice);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCore::GetPermissionList(nsString& aPermissionList)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
nsINetService *netservice;
|
||||||
|
nsresult res;
|
||||||
|
res = nsServiceManager::GetService(kNetServiceCID,
|
||||||
|
kINetServiceIID,
|
||||||
|
(nsISupports **)&netservice);
|
||||||
|
if ((NS_OK == res) && (nsnull != netservice)) {
|
||||||
|
res = netservice->Cookie_GetPermissionListForViewer(aPermissionList);
|
||||||
|
nsServiceManager::ReleaseService(kNetServiceCID, netservice);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
/* -*- 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "nsCookieCoreFactory.h"
|
||||||
|
|
||||||
|
#include "nsAppCores.h"
|
||||||
|
#include "nsCookieCore.h"
|
||||||
|
#include "pratom.h"
|
||||||
|
#include "nsISupportsUtils.h"
|
||||||
|
|
||||||
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
|
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
nsCookieCoreFactory::nsCookieCoreFactory()
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
NS_INIT_REFCNT();
|
||||||
|
IncInstanceCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
nsCookieCoreFactory::~nsCookieCoreFactory()
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
DecInstanceCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF(nsCookieCoreFactory)
|
||||||
|
NS_IMPL_RELEASE(nsCookieCoreFactory)
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCoreFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
if (aInstancePtr == NULL)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
// Always NULL result, in case of failure
|
||||||
|
*aInstancePtr = NULL;
|
||||||
|
|
||||||
|
if ( aIID.Equals(kISupportsIID) )
|
||||||
|
*aInstancePtr = (void*) this;
|
||||||
|
else if ( aIID.Equals(kIFactoryIID) )
|
||||||
|
*aInstancePtr = (void*) this;
|
||||||
|
|
||||||
|
if (aInstancePtr == NULL)
|
||||||
|
return NS_ERROR_NO_INTERFACE;
|
||||||
|
|
||||||
|
AddRef();
|
||||||
|
return NS_OK;
|
||||||
|
} // nsCookieCoreFactory::QueryInterface
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCoreFactory::CreateInstance(
|
||||||
|
nsISupports* aOuter,
|
||||||
|
REFNSIID aIID,
|
||||||
|
void **aResult)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
if (aResult == NULL)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
*aResult = NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// There is a stupid bug that I don't feel competent to fix. Basically, the
|
||||||
|
// AppCore Manager is a waste of time (the manager gets created, an app core is
|
||||||
|
// added to the list, and then the app core manager is deleted, along with its list).
|
||||||
|
// I want to insist that
|
||||||
|
// there is always one instance of the Cookie app core. Hence this HACK.
|
||||||
|
static nsCookieCore* inst = nsnull;
|
||||||
|
PRBool firstTime = (inst == nsnull);
|
||||||
|
if (firstTime)
|
||||||
|
{
|
||||||
|
inst = new nsCookieCore();
|
||||||
|
if (!inst)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
NS_ADDREF(inst);
|
||||||
|
}
|
||||||
|
nsresult result = inst->QueryInterface(aIID, aResult);
|
||||||
|
if (result != NS_OK && firstTime)
|
||||||
|
NS_RELEASE(inst);
|
||||||
|
#else
|
||||||
|
static nsCookieCore* inst = new nsCookieCore();
|
||||||
|
if (!inst)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
nsresult result = inst->QueryInterface(aIID, aResult);
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
|
} // nsCookieCoreFactory::CreateInstance
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
NS_IMETHODIMP nsCookieCoreFactory::LockFactory(PRBool aLock)
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
{
|
||||||
|
if (aLock)
|
||||||
|
IncLockCount();
|
||||||
|
else
|
||||||
|
DecLockCount();
|
||||||
|
return NS_OK;
|
||||||
|
} // nsCookieCoreFactory::LockFactory
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* -*- 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 "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.
|
||||||
|
*/
|
||||||
|
#ifndef nsCookieCoreFactory_h___
|
||||||
|
#define nsCookieCoreFactory_h___
|
||||||
|
|
||||||
|
//#include "nscore.h"
|
||||||
|
//#include "nsString.h"
|
||||||
|
#include "nsIFactory.h"
|
||||||
|
#include "nsISupports.h"
|
||||||
|
|
||||||
|
//========================================================================================
|
||||||
|
class nsCookieCoreFactory : public nsIFactory
|
||||||
|
//========================================================================================
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
nsCookieCoreFactory();
|
||||||
|
virtual ~nsCookieCoreFactory();
|
||||||
|
|
||||||
|
PRBool CanUnload(void);
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||||
|
REFNSIID aIID,
|
||||||
|
void **aResult);
|
||||||
|
|
||||||
|
NS_IMETHOD LockFactory(PRBool aLock);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // nsCookieCoreFactory_h___
|
|
@ -45,6 +45,7 @@ EXPORT_RESOURCE_SAMPLES = \
|
||||||
$(srcdir)/PrefsWindow.html \
|
$(srcdir)/PrefsWindow.html \
|
||||||
$(srcdir)/PrefsWindow.js \
|
$(srcdir)/PrefsWindow.js \
|
||||||
$(srcdir)/SignonWindow.js \
|
$(srcdir)/SignonWindow.js \
|
||||||
|
$(srcdir)/CookieWindow.js \
|
||||||
$(srcdir)/WalletWindow.js \
|
$(srcdir)/WalletWindow.js \
|
||||||
$(srcdir)/preftree.css \
|
$(srcdir)/preftree.css \
|
||||||
$(srcdir)/preftree.xul \
|
$(srcdir)/preftree.xul \
|
||||||
|
|
|
@ -571,11 +571,15 @@
|
||||||
|
|
||||||
function CookieViewer()
|
function CookieViewer()
|
||||||
{
|
{
|
||||||
if (appCore != null) {
|
var cookieCore = XPAppCoresManager.Find("CookieCore");
|
||||||
dump("CookieViewer\n");
|
if (!cookieCore) {
|
||||||
appCore.cookieViewer();
|
cookieCore = new CookieCore();
|
||||||
} else {
|
if (cookieCore) {
|
||||||
dump("BrowserAppCore has not been created!\n");
|
cookieCore.Init("CookieCore");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cookieCore) {
|
||||||
|
cookieCore.ShowWindow(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче