зеркало из https://github.com/mozilla/gecko-dev.git
reimplement cookie viewer
This commit is contained in:
Родитель
8bd98decde
Коммит
b9555384aa
|
@ -38,6 +38,7 @@ CPPSRCS= \
|
|||
nsDOMPropsCoreFactory.cpp \
|
||||
nsPrefsCore.cpp \
|
||||
nsSignonCore.cpp \
|
||||
nsCookieCore.cpp \
|
||||
nsWalletCore.cpp \
|
||||
nsProfileCore.cpp \
|
||||
nsRDFCore.cpp \
|
||||
|
@ -50,6 +51,7 @@ CPPSRCS= \
|
|||
nsBrowserAppCore.cpp \
|
||||
nsPrefsCoreFactory.cpp \
|
||||
nsSignonCoreFactory.cpp \
|
||||
nsCookieCoreFactory.cpp \
|
||||
nsWalletCoreFactory.cpp \
|
||||
nsProfileCoreFactory.cpp \
|
||||
nsToolbarCoreFactory.cpp \
|
||||
|
@ -63,6 +65,7 @@ CPPSRCS= \
|
|||
nsJSEditorAppCore.cpp \
|
||||
nsJSPrefsCore.cpp \
|
||||
nsJSSignonCore.cpp \
|
||||
nsJSCookieCore.cpp \
|
||||
nsJSWalletCore.cpp \
|
||||
nsJSProfileCore.cpp \
|
||||
nsJSRDFCore.cpp \
|
||||
|
|
|
@ -72,6 +72,7 @@ OBJS = \
|
|||
.\$(OBJDIR)\nsDOMPropsCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsPrefsCore.obj \
|
||||
.\$(OBJDIR)\nsSignonCore.obj \
|
||||
.\$(OBJDIR)\nsCookieCore.obj \
|
||||
.\$(OBJDIR)\nsWalletCore.obj \
|
||||
.\$(OBJDIR)\nsProfileCore.obj \
|
||||
.\$(OBJDIR)\nsRDFCore.obj \
|
||||
|
@ -84,6 +85,7 @@ OBJS = \
|
|||
.\$(OBJDIR)\nsBrowserAppCore.obj \
|
||||
.\$(OBJDIR)\nsPrefsCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsSignonCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsCookieCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsWalletCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsProfileCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsBrowserAppCoreFactory.obj \
|
||||
|
@ -94,6 +96,7 @@ OBJS = \
|
|||
.\$(OBJDIR)\nsJSDOMPropsCore.obj \
|
||||
.\$(OBJDIR)\nsJSPrefsCore.obj \
|
||||
.\$(OBJDIR)\nsJSSignonCore.obj \
|
||||
.\$(OBJDIR)\nsJSCookieCore.obj \
|
||||
.\$(OBJDIR)\nsJSWalletCore.obj \
|
||||
.\$(OBJDIR)\nsJSProfileCore.obj \
|
||||
.\$(OBJDIR)\nsJSRDFCore.obj \
|
||||
|
@ -132,6 +135,7 @@ install:: $(DLL)
|
|||
$(MAKE_INSTALL) ..\xul\PrefsWindow.html $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) ..\xul\PrefsWindow.js $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) ..\xul\SignonWindow.js $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) ..\xul\CookieWindow.js $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) ..\xul\WalletWindow.js $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) ..\xul\preftree.css $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) ..\xul\preftree.xul $(DIST)\bin\res\samples
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsDOMPropsCoreFactory.h"
|
||||
#include "nsPrefsCoreFactory.h"
|
||||
#include "nsSignonCoreFactory.h"
|
||||
#include "nsCookieCoreFactory.h"
|
||||
#include "nsWalletCoreFactory.h"
|
||||
#include "nsProfileCoreFactory.h"
|
||||
#include "nsRDFCoreFactory.h"
|
||||
|
@ -43,6 +44,7 @@ static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
|||
static NS_DEFINE_IID(kDOMPropsCoreCID, NS_DOMPROPSCORE_CID);
|
||||
static NS_DEFINE_IID(kPrefsCoreCID, NS_PREFSCORE_CID);
|
||||
static NS_DEFINE_IID(kSignonCoreCID, NS_SIGNONCORE_CID);
|
||||
static NS_DEFINE_IID(kCookieCoreCID, NS_COOKIECORE_CID);
|
||||
static NS_DEFINE_IID(kWalletCoreCID, NS_WALLETCORE_CID);
|
||||
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
static NS_DEFINE_IID(kRDFCoreCID, NS_RDFCORE_CID);
|
||||
|
@ -71,6 +73,7 @@ NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
|||
nsComponentManager::RegisterComponent(kDOMPropsCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kPrefsCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kSignonCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kCookieCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kWalletCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kProfileCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kRDFCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
|
@ -90,6 +93,7 @@ NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
|||
nsComponentManager::UnregisterComponent(kDOMPropsCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kPrefsCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kSignonCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kCookieCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kWalletCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kProfileCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kRDFCoreCID, path);
|
||||
|
@ -134,6 +138,10 @@ NSGetFactory(nsISupports* serviceMgr,
|
|||
{
|
||||
inst = new nsSignonCoreFactory();
|
||||
}
|
||||
else if ( aClass.Equals(kCookieCoreCID) )
|
||||
{
|
||||
inst = new nsCookieCoreFactory();
|
||||
}
|
||||
else if ( aClass.Equals(kWalletCoreCID) )
|
||||
{
|
||||
inst = new nsWalletCoreFactory();
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsIDOMToolkitCore.h"
|
||||
#include "nsIDOMPrefsCore.h"
|
||||
#include "nsIDOMSignonCore.h"
|
||||
#include "nsIDOMCookieCore.h"
|
||||
#include "nsIDOMWalletCore.h"
|
||||
#include "nsIDOMProfileCore.h"
|
||||
#include "nsIDOMRDFCore.h"
|
||||
|
@ -44,6 +45,7 @@ static NS_DEFINE_IID(kToolkitCoreCID, NS_TOOLKITCORE_CID);
|
|||
static NS_DEFINE_IID(kDOMPropsCoreCID, NS_DOMPROPSCORE_CID);
|
||||
static NS_DEFINE_IID(kPrefsCoreCID, NS_PREFSCORE_CID);
|
||||
static NS_DEFINE_IID(kSignonCoreCID, NS_SIGNONCORE_CID);
|
||||
static NS_DEFINE_IID(kCookieCoreCID, NS_COOKIECORE_CID);
|
||||
static NS_DEFINE_IID(kWalletCoreCID, NS_WALLETCORE_CID);
|
||||
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
static NS_DEFINE_IID(kRDFCoreCID, NS_RDFCORE_CID);
|
||||
|
@ -76,6 +78,7 @@ nsAppCoresNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
|||
result = NS_InitDOMPropsCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitPrefsCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitSignonCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitCookieCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitWalletCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitProfileCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitToolbarCoreClass(aScriptContext, nsnull);
|
||||
|
@ -121,6 +124,14 @@ nsAppCoresNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
|||
|
||||
|
||||
|
||||
result = manager->RegisterGlobalName("CookieCore",
|
||||
kCookieCoreCID,
|
||||
PR_TRUE);
|
||||
|
||||
if (NS_OK != result) return result;
|
||||
|
||||
|
||||
|
||||
result = manager->RegisterGlobalName("WalletCore",
|
||||
kWalletCoreCID,
|
||||
PR_TRUE);
|
||||
|
|
|
@ -468,91 +468,6 @@ nsBrowserAppCore::WalletQuickFillin(nsIDOMWindow* aWin)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef xxx
|
||||
NS_IMETHODIMP
|
||||
nsBrowserAppCore::WalletSafeFillin(nsIDOMWindow* aWin, nsIDOMWindow* aForm)
|
||||
{
|
||||
NS_PRECONDITION(aForm != nsnull, "null ptr");
|
||||
if (! aForm)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIPresShell* shell;
|
||||
shell = nsnull;
|
||||
nsCOMPtr<nsIWebShell> webcontent;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
|
||||
scriptGlobalObject = do_QueryInterface(aForm);
|
||||
scriptGlobalObject->GetWebShell(getter_AddRefs(webcontent));
|
||||
|
||||
nsresult res;
|
||||
nsString urlString = nsString("");
|
||||
if ( mContentAreaWebShell ) {
|
||||
const PRUnichar *url = 0;
|
||||
PRInt32 history;
|
||||
res = mContentAreaWebShell->GetHistoryIndex(history);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = mContentAreaWebShell->GetURL( history, &url );
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
urlString = nsString(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shell = GetPresShellFor(webcontent);
|
||||
nsIWalletService *walletservice;
|
||||
res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&walletservice);
|
||||
if (NS_SUCCEEDED(res) && (nsnull != walletservice)) {
|
||||
res = walletservice->WALLET_Prefill(shell, urlString, PR_TRUE);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, walletservice);
|
||||
}
|
||||
|
||||
// (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/htmldlgs.htm");
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserAppCore::WalletSamples()
|
||||
{
|
||||
|
@ -584,32 +499,6 @@ nsBrowserAppCore::WalletSafeFillin(nsIDOMWindow*, nsIDOMWindow*) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CookieManagement
|
||||
NS_IMETHODIMP
|
||||
nsBrowserAppCore::CookieViewer()
|
||||
{
|
||||
nsINetService *netservice;
|
||||
nsresult res;
|
||||
res = nsServiceManager::GetService(kNetServiceCID,
|
||||
kINetServiceIID,
|
||||
(nsISupports **)&netservice);
|
||||
if ((NS_OK == res) && (nsnull != netservice)) {
|
||||
res = netservice->NET_DisplayCookieInfoAsHTML();
|
||||
nsServiceManager::ReleaseService(kNetServiceCID, netservice);
|
||||
}
|
||||
#ifndef HTMLDialogs
|
||||
return newWind("file:///htmldlgs.htm");
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
#else
|
||||
NS_IMETHODIMP
|
||||
nsBrowserAppCore::CookieViewer()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserAppCore::LoadUrl(const nsString& aUrl)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,6 @@ class nsBrowserAppCore : public nsBaseAppCore,
|
|||
NS_IMETHOD WalletChangePassword();
|
||||
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin);
|
||||
NS_IMETHOD WalletSamples();
|
||||
NS_IMETHOD CookieViewer();
|
||||
|
||||
NS_IMETHOD LoadUrl(const nsString& aUrl);
|
||||
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin);
|
||||
|
|
|
@ -440,39 +440,6 @@ BrowserAppCoreWalletSamples(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method CookieViewer
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
BrowserAppCoreCookieViewer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (argc >= 0) {
|
||||
|
||||
if (NS_OK != nativeThis->CookieViewer()) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function cookieViewer requires 0 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetToolbarWindow
|
||||
//
|
||||
|
@ -937,7 +904,6 @@ static JSFunctionSpec BrowserAppCoreMethods[] =
|
|||
{"walletChangePassword", BrowserAppCoreWalletChangePassword, 0},
|
||||
{"walletQuickFillin", BrowserAppCoreWalletQuickFillin, 1},
|
||||
{"walletSamples", BrowserAppCoreWalletSamples, 0},
|
||||
{"cookieViewer", BrowserAppCoreCookieViewer, 0},
|
||||
{"setToolbarWindow", BrowserAppCoreSetToolbarWindow, 1},
|
||||
{"setContentWindow", BrowserAppCoreSetContentWindow, 1},
|
||||
{"setWebShellWindow", BrowserAppCoreSetWebShellWindow, 1},
|
||||
|
|
|
@ -43,6 +43,7 @@ static NS_DEFINE_IID(kToolkitCoreCID, NS_TOOLKITCORE_CID);
|
|||
static NS_DEFINE_IID(kDOMPropsCoreCID, NS_DOMPROPSCORE_CID);
|
||||
static NS_DEFINE_IID(kPrefsCoreCID, NS_PREFSCORE_CID);
|
||||
static NS_DEFINE_IID(kSignonCoreCID, NS_SIGNONCORE_CID);
|
||||
static NS_DEFINE_IID(kCookieCoreCID, NS_COOKIECORE_CID);
|
||||
static NS_DEFINE_IID(kWalletCoreCID, NS_WALLETCORE_CID);
|
||||
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
static NS_DEFINE_IID(kToolbarCoreCID, NS_TOOLBARCORE_CID);
|
||||
|
@ -153,6 +154,7 @@ NS_SetupRegistry_1()
|
|||
nsComponentManager::RegisterComponent(kDOMPropsCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponent(kPrefsCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponent(kSignonCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponent(kCookieCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponent(kWalletCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponent(kProfileCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponent(kToolbarCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче