mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 11:38:16 +00:00
remove cookie viewer from appcores
This commit is contained in:
parent
4283cfdd5f
commit
23802a8505
42
extensions/wallet/cookieviewer/Makefile.in
Normal file
42
extensions/wallet/cookieviewer/Makefile.in
Normal file
@ -0,0 +1,42 @@
|
||||
#!gmake
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = cookieviewer
|
||||
LIBRARY_NAME = cookieviewer
|
||||
IS_COMPONENT = 1
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsICookieViewer.idl \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsCookieViewerFactory.cpp \
|
||||
nsCookieViewer.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = walleteditor raptor xpcom
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
install:: $(TARGETS)
|
||||
$(INSTALL) $(srcdir)/xpconnect-cookieviewer.html $(DIST)/bin/res/samples
|
48
extensions/wallet/cookieviewer/makefile.win
Normal file
48
extensions/wallet/cookieviewer/makefile.win
Normal file
@ -0,0 +1,48 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH=..\..\..
|
||||
MODULE=cookieviewer
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=$(MODULE)
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
XPIDLSRCS= .\nsICookieViewer.idl \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsCookieViewerFactory.obj \
|
||||
.\$(OBJDIR)\nsCookieViewer.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\plc3.lib \
|
||||
$(NULL)
|
||||
|
||||
LINCS=\
|
||||
-I$(PUBLIC)\walleteditor \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) xpconnect-cookieviewer.html $(DIST)\bin\res\samples
|
182
extensions/wallet/cookieviewer/nsCookieViewer.cpp
Normal file
182
extensions/wallet/cookieviewer/nsCookieViewer.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIAllocator.h"
|
||||
#include "plstr.h"
|
||||
#include "stdio.h"
|
||||
#include "nsINetService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsICookieViewer.h"
|
||||
|
||||
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
|
||||
class CookieViewerImpl : public nsICookieViewer
|
||||
{
|
||||
public:
|
||||
CookieViewerImpl();
|
||||
virtual ~CookieViewerImpl();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsICookieViewer interface
|
||||
NS_IMETHOD GetCookieValue(char * *aValue);
|
||||
NS_IMETHOD GetPermissionValue(char * *aValue);
|
||||
NS_IMETHOD SetValue(const char *aValue, nsIDOMWindow *win);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewCookieViewer(nsICookieViewer** aCookieViewer)
|
||||
{
|
||||
NS_PRECONDITION(aCookieViewer != nsnull, "null ptr");
|
||||
if (!aCookieViewer) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aCookieViewer = new CookieViewerImpl();
|
||||
if (! *aCookieViewer) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(*aCookieViewer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CookieViewerImpl::CookieViewerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
CookieViewerImpl::~CookieViewerImpl()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(CookieViewerImpl, nsICookieViewer::GetIID());
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieViewerImpl::GetCookieValue(char** aValue)
|
||||
{
|
||||
NS_PRECONDITION(aValue != nsnull, "null ptr");
|
||||
if (!aValue) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsINetService *netservice;
|
||||
nsresult res;
|
||||
res = nsServiceManager::GetService(kNetServiceCID,
|
||||
kINetServiceIID,
|
||||
(nsISupports **)&netservice);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull != netservice)) {
|
||||
nsAutoString cookieList;
|
||||
res = netservice->Cookie_GetCookieListForViewer(cookieList);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
*aValue = cookieList.ToNewCString();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieViewerImpl::GetPermissionValue(char** aValue)
|
||||
{
|
||||
NS_PRECONDITION(aValue != nsnull, "null ptr");
|
||||
if (!aValue) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsINetService *netservice;
|
||||
nsresult res;
|
||||
res = nsServiceManager::GetService(kNetServiceCID,
|
||||
kINetServiceIID,
|
||||
(nsISupports **)&netservice);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull != netservice)) {
|
||||
nsAutoString PermissionList;
|
||||
res = netservice->Cookie_GetPermissionListForViewer(PermissionList);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
*aValue = PermissionList.ToNewCString();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieViewerImpl::SetValue(const char* aValue, nsIDOMWindow* win)
|
||||
{
|
||||
/* close the window */
|
||||
if (!win) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsIDOMWindow* top;
|
||||
win->GetTop(&top);
|
||||
if (!top) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(top, &parent);
|
||||
if (parent) {
|
||||
parent->Close();
|
||||
}
|
||||
NS_IF_RELEASE(win);
|
||||
|
||||
/* process the value */
|
||||
NS_PRECONDITION(aValue != nsnull, "null ptr");
|
||||
if (! aValue) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsINetService *netservice;
|
||||
nsresult res;
|
||||
res = nsServiceManager::GetService(kNetServiceCID,
|
||||
kINetServiceIID,
|
||||
(nsISupports **)&netservice);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull != netservice)) {
|
||||
nsAutoString netList = aValue;
|
||||
res = netservice->Cookie_CookieViewerReturn(netList);
|
||||
}
|
||||
return res;
|
||||
}
|
206
extensions/wallet/cookieviewer/nsCookieViewerFactory.cpp
Normal file
206
extensions/wallet/cookieviewer/nsCookieViewerFactory.cpp
Normal file
@ -0,0 +1,206 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
A sample of XPConnect. This file contains the XPCOM factory the
|
||||
creates for CookieViewerImpl objects.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsICookieViewer.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPComFactory.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kCookieViewerCID, NS_COOKIEVIEWER_CID);
|
||||
|
||||
class CookieViewerFactoryImpl : public nsIFactory
|
||||
{
|
||||
public:
|
||||
CookieViewerFactoryImpl(const nsCID &aClass, const char* className, const char* progID);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~CookieViewerFactoryImpl();
|
||||
|
||||
protected:
|
||||
nsCID mClassID;
|
||||
const char* mClassName;
|
||||
const char* mProgID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CookieViewerFactoryImpl::CookieViewerFactoryImpl(const nsCID &aClass,
|
||||
const char* className,
|
||||
const char* progID)
|
||||
: mClassID(aClass), mClassName(className), mProgID(progID)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
CookieViewerFactoryImpl::~CookieViewerFactoryImpl()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieViewerFactoryImpl::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(CookieViewerFactoryImpl);
|
||||
NS_IMPL_RELEASE(CookieViewerFactoryImpl);
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieViewerFactoryImpl::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kCookieViewerCID)) {
|
||||
if (NS_FAILED(rv = NS_NewCookieViewer((nsICookieViewer**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
if (! inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult))) {
|
||||
// We didn't get the right interface.
|
||||
NS_ERROR("didn't support the interface you wanted");
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(inst);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult CookieViewerFactoryImpl::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (! aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
CookieViewerFactoryImpl* factory = new CookieViewerFactoryImpl(aClass, aClassName, aProgID);
|
||||
if (factory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(factory);
|
||||
*aFactory = factory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIComponentManager, compMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kCookieViewerCID,
|
||||
"CookieViewer World Component",
|
||||
"component://netscape/cookieviewer/cookieviewer-world",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIComponentManager, compMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kCookieViewerCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
46
extensions/wallet/cookieviewer/nsICookieViewer.idl
Normal file
46
extensions/wallet/cookieviewer/nsICookieViewer.idl
Normal file
@ -0,0 +1,46 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
A sample of XPConnect. This file contains a CookieViewer interface.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
%{C++
|
||||
#include "nsIDOMWindow.h"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(BBB67DF0-214B-11d3-ABAA-0080C787AD96)]
|
||||
interface nsICookieViewer : nsISupports
|
||||
{
|
||||
void SetValue(in string aValue, in nsIDOMWindow win);
|
||||
string GetCookieValue();
|
||||
string GetPermissionValue();
|
||||
};
|
||||
|
||||
%{ C++
|
||||
// {BBB67DF0-214B-11d3-ABAA-0080C787AD96}
|
||||
#define NS_COOKIEVIEWER_CID \
|
||||
{ 0xbbb67df0, 0x214b, 0x11d3, { 0xab, 0xaa, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96 } };
|
||||
|
||||
extern nsresult
|
||||
NS_NewCookieViewer(nsICookieViewer** aCookieViewer);
|
||||
%}
|
368
extensions/wallet/cookieviewer/xpconnect-cookieviewer.html
Normal file
368
extensions/wallet/cookieviewer/xpconnect-cookieviewer.html
Normal file
@ -0,0 +1,368 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Cookies</TITLE>
|
||||
<SCRIPT>
|
||||
|
||||
/* 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>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.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 = list.split(BREAK);
|
||||
|
||||
/*
|
||||
* The permissionList is a sequence of items separated by the BREAK character. These
|
||||
* items are:
|
||||
* empty
|
||||
* number for first permission
|
||||
* +/- hostname for first permission
|
||||
* with the above two items repeated for each successive permission
|
||||
*/
|
||||
list = DoGetPermissionList();
|
||||
BREAK = list[0];
|
||||
permissionList = list.split(BREAK);
|
||||
loadCookies();
|
||||
loadButtons();
|
||||
}
|
||||
|
||||
function Save(){
|
||||
var goneC = top.frames[button_frame].document.buttons.goneC;
|
||||
var goneP = top.frames[button_frame].document.buttons.goneP;
|
||||
var result = "|goneC|"+goneC.value+"|goneP|"+goneP.value+"|";
|
||||
DoSave(result);
|
||||
}
|
||||
|
||||
function Cancel(){
|
||||
var result = "|goneC||goneP||";
|
||||
DoSave(result);
|
||||
}
|
||||
|
||||
</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>
|
Loading…
x
Reference in New Issue
Block a user