remove wallet-related stuff from appcores

This commit is contained in:
morse%netscape.com 1999-06-13 15:01:07 +00:00
Родитель f4e4f112db
Коммит 8ec7170a2f
8 изменённых файлов: 419 добавлений и 75 удалений

Просмотреть файл

@ -21,7 +21,7 @@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
DIRS=public src editor DIRS=public src editor signonviewer cookieviewer walletpreview
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/config.mk

Просмотреть файл

@ -17,6 +17,6 @@
DEPTH=..\.. DEPTH=..\..
DIRS=public src editor DIRS=public src editor signonviewer cookieviewer walletpreview
include <$(DEPTH)\config\rules.mak> include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -11,6 +11,9 @@ interface BrowserAppCore : BaseAppCore
void loadUrl(in wstring url); void loadUrl(in wstring url);
void loadInitialPage(); void loadInitialPage();
void walletPreview(in Window win, in Window form);
void cookieViewer(in Window win);
void signonViewer(in Window win);
void walletEditor(in Window win); void walletEditor(in Window win);
void walletChangePassword(); void walletChangePassword();
void walletQuickFillin(in Window win); void walletQuickFillin(in Window win);

Просмотреть файл

@ -45,6 +45,12 @@ public:
NS_IMETHOD LoadInitialPage()=0; NS_IMETHOD LoadInitialPage()=0;
NS_IMETHOD WalletPreview(nsIDOMWindow* aWin, nsIDOMWindow* aForm)=0;
NS_IMETHOD CookieViewer(nsIDOMWindow* aWin)=0;
NS_IMETHOD SignonViewer(nsIDOMWindow* aWin)=0;
NS_IMETHOD WalletEditor(nsIDOMWindow* aWin)=0; NS_IMETHOD WalletEditor(nsIDOMWindow* aWin)=0;
NS_IMETHOD WalletChangePassword()=0; NS_IMETHOD WalletChangePassword()=0;
@ -85,6 +91,9 @@ public:
NS_IMETHOD Stop(); \ NS_IMETHOD Stop(); \
NS_IMETHOD LoadUrl(const nsString& aUrl); \ NS_IMETHOD LoadUrl(const nsString& aUrl); \
NS_IMETHOD LoadInitialPage(); \ NS_IMETHOD LoadInitialPage(); \
NS_IMETHOD WalletPreview(nsIDOMWindow* aWin, nsIDOMWindow* aForm); \
NS_IMETHOD CookieViewer(nsIDOMWindow* aWin); \
NS_IMETHOD SignonViewer(nsIDOMWindow* aWin); \
NS_IMETHOD WalletEditor(nsIDOMWindow* aWin); \ NS_IMETHOD WalletEditor(nsIDOMWindow* aWin); \
NS_IMETHOD WalletChangePassword(); \ NS_IMETHOD WalletChangePassword(); \
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); \ NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); \
@ -110,6 +119,9 @@ public:
NS_IMETHOD Stop() { return _to Stop(); } \ NS_IMETHOD Stop() { return _to Stop(); } \
NS_IMETHOD LoadUrl(const nsString& aUrl) { return _to LoadUrl(aUrl); } \ NS_IMETHOD LoadUrl(const nsString& aUrl) { return _to LoadUrl(aUrl); } \
NS_IMETHOD LoadInitialPage() { return _to LoadInitialPage(); } \ NS_IMETHOD LoadInitialPage() { return _to LoadInitialPage(); } \
NS_IMETHOD WalletPreview(nsIDOMWindow* aWin, nsIDOMWindow* aForm) { return _to WalletPreview(aWin, aForm); } \
NS_IMETHOD CookieViewer(nsIDOMWindow* aWin) { return _to CookieViewer(aWin); } \
NS_IMETHOD SignonViewer(nsIDOMWindow* aWin) { return _to SignonViewer(aWin); } \
NS_IMETHOD WalletEditor(nsIDOMWindow* aWin) { return _to WalletEditor(aWin); } \ NS_IMETHOD WalletEditor(nsIDOMWindow* aWin) { return _to WalletEditor(aWin); } \
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); } \

Просмотреть файл

@ -461,33 +461,188 @@ nsBrowserAppCore::WalletEditor(nsIDOMWindow* aWin)
if (NS_SUCCEEDED(gotParent)) if (NS_SUCCEEDED(gotParent))
parentWindowWidgetThing->Enable(PR_TRUE); parentWindowWidgetThing->Enable(PR_TRUE);
} }
return rv; return rv;
}
#ifdef xxx NS_IMETHODIMP
/* set a cookie for the wallet editor */ nsBrowserAppCore::SignonViewer(nsIDOMWindow* aWin)
nsIWalletService *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/xpconnect-signonviewer.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(aWin, &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;
}
NS_IMETHODIMP
nsBrowserAppCore::CookieViewer(nsIDOMWindow* aWin)
{
// (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/xpconnect-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(aWin, &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;
}
NS_IMETHODIMP
nsBrowserAppCore::WalletPreview(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));
/* obtain the url */
nsresult res; nsresult res;
res = nsServiceManager::GetService(kWalletServiceCID, nsString urlString = nsString("");
kIWalletServiceIID, if (webcontent) {
(nsISupports **)&walletservice); const PRUnichar *url = 0;
nsFileSpec dirSpec; PRInt32 history;
nsresult rv = ProfileDirectory(dirSpec); res = webcontent->GetHistoryIndex(history);
if (NS_FAILED(rv)) { if (NS_SUCCEEDED(res)) {
return rv; res = webcontent->GetURL( history, &url );
} if (NS_SUCCEEDED(res)) {
nsFileURL u = nsFileURL(dirSpec + WALLET_EDITOR_NAME); urlString = nsString(url);
if ((NS_OK == res) && (nsnull != walletservice)) { }
nsIURL * url;
if (!NS_FAILED(NS_NewURL(&url, (char *)(u.GetURLString())))) {
res = walletservice->WALLET_PreEdit(url);
nsServiceManager::ReleaseService(kWalletServiceCID, walletservice);
} }
} }
/* bring up the wallet editor in a new window */ shell = GetPresShellFor(webcontent);
return newWind((char *)(u.GetURLString())); nsIWalletService *walletservice;
#endif res = nsServiceManager::GetService(kWalletServiceCID,
kIWalletServiceIID,
(nsISupports **)&walletservice);
if (NS_SUCCEEDED(res) && (nsnull != walletservice)) {
res = walletservice->WALLET_Prefill(shell, urlString, PR_FALSE);
nsServiceManager::ReleaseService(kWalletServiceCID, walletservice);
if (NS_FAILED(res)) { /* this just means that there was nothing to prefill */
return NS_OK;
}
} else {
return res;
}
// (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/xpconnect-walletpreview.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(aWin, &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;
} }
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -67,6 +67,9 @@ class nsBrowserAppCore : public nsBaseAppCore,
NS_IMETHOD Forward(); NS_IMETHOD Forward();
NS_IMETHOD Stop(); NS_IMETHOD Stop();
NS_IMETHOD WalletPreview(nsIDOMWindow* aWin, nsIDOMWindow* aForm);
NS_IMETHOD SignonViewer(nsIDOMWindow* aWin);
NS_IMETHOD CookieViewer(nsIDOMWindow* aWin);
NS_IMETHOD WalletEditor(nsIDOMWindow* aWin); NS_IMETHOD WalletEditor(nsIDOMWindow* aWin);
NS_IMETHOD WalletChangePassword(); NS_IMETHOD WalletChangePassword();
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin);

Просмотреть файл

@ -52,7 +52,7 @@ NS_DEF_PTR(nsIDOMWindow);
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
GetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) GetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{ {
nsIDOMBrowserAppCore *a = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *a = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore // If there's no private data, this must be the prototype, so ignore
if (nsnull == a) { if (nsnull == a) {
@ -62,7 +62,7 @@ GetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) { if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx); nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan; nsIScriptSecurityManager *secMan;
PRBool ok; PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) { if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE; return JS_FALSE;
} }
@ -87,7 +87,7 @@ GetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
SetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) SetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{ {
nsIDOMBrowserAppCore *a = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *a = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore // If there's no private data, this must be the prototype, so ignore
if (nsnull == a) { if (nsnull == a) {
@ -97,7 +97,7 @@ SetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) { if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx); nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan; nsIScriptSecurityManager *secMan;
PRBool ok; PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) { if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE; return JS_FALSE;
} }
@ -152,7 +152,7 @@ ResolveBrowserAppCore(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreBack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreBack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -200,7 +200,7 @@ BrowserAppCoreBack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreForward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreForward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -248,7 +248,7 @@ BrowserAppCoreForward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreStop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreStop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -296,7 +296,7 @@ BrowserAppCoreStop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreLoadUrl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreLoadUrl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
nsAutoString b0; nsAutoString b0;
@ -347,7 +347,7 @@ BrowserAppCoreLoadUrl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreLoadInitialPage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreLoadInitialPage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -389,13 +389,193 @@ BrowserAppCoreLoadInitialPage(JSContext *cx, JSObject *obj, uintN argc, jsval *a
} }
//
// Native method WalletPreview
//
PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreWalletPreview(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0;
nsIDOMWindowPtr b1;
*rval = JSVAL_NULL;
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
if (NS_OK == scriptCX->GetSecurityManager(&secMan)) {
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, "browserappcore.walletpreview", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
NS_RELEASE(secMan);
}
else {
return JS_FALSE;
}
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 2) {
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0,
kIWindowIID,
"Window",
cx,
argv[0])) {
return JS_FALSE;
}
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b1,
kIWindowIID,
"Window",
cx,
argv[1])) {
return JS_FALSE;
}
if (NS_OK != nativeThis->WalletPreview(b0, b1)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function walletPreview requires 2 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method CookieViewer
//
PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreCookieViewer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0;
*rval = JSVAL_NULL;
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
if (NS_OK == scriptCX->GetSecurityManager(&secMan)) {
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, "browserappcore.cookieviewer", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
NS_RELEASE(secMan);
}
else {
return JS_FALSE;
}
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0,
kIWindowIID,
"Window",
cx,
argv[0])) {
return JS_FALSE;
}
if (NS_OK != nativeThis->CookieViewer(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function cookieViewer requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method SignonViewer
//
PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreSignonViewer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0;
*rval = JSVAL_NULL;
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
if (NS_OK == scriptCX->GetSecurityManager(&secMan)) {
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, "browserappcore.signonviewer", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
NS_RELEASE(secMan);
}
else {
return JS_FALSE;
}
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0,
kIWindowIID,
"Window",
cx,
argv[0])) {
return JS_FALSE;
}
if (NS_OK != nativeThis->SignonViewer(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function signonViewer requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
// //
// Native method WalletEditor // Native method WalletEditor
// //
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreWalletEditor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreWalletEditor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0; nsIDOMWindowPtr b0;
@ -452,7 +632,7 @@ BrowserAppCoreWalletEditor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreWalletChangePassword(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreWalletChangePassword(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -500,7 +680,7 @@ BrowserAppCoreWalletChangePassword(JSContext *cx, JSObject *obj, uintN argc, jsv
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreWalletQuickFillin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreWalletQuickFillin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0; nsIDOMWindowPtr b0;
@ -557,7 +737,7 @@ BrowserAppCoreWalletQuickFillin(JSContext *cx, JSObject *obj, uintN argc, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreWalletSamples(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreWalletSamples(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -605,7 +785,7 @@ BrowserAppCoreWalletSamples(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreSetToolbarWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreSetToolbarWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0; nsIDOMWindowPtr b0;
@ -662,7 +842,7 @@ BrowserAppCoreSetToolbarWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreSetContentWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreSetContentWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0; nsIDOMWindowPtr b0;
@ -719,7 +899,7 @@ BrowserAppCoreSetContentWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreSetWebShellWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreSetWebShellWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0; nsIDOMWindowPtr b0;
@ -776,7 +956,7 @@ BrowserAppCoreSetWebShellWindow(JSContext *cx, JSObject *obj, uintN argc, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreNewWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreNewWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -824,7 +1004,7 @@ BrowserAppCoreNewWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreOpenWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreOpenWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -872,7 +1052,7 @@ BrowserAppCoreOpenWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCorePrintPreview(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCorePrintPreview(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -920,7 +1100,7 @@ BrowserAppCorePrintPreview(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreCopy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreCopy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -968,7 +1148,7 @@ BrowserAppCoreCopy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCorePrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCorePrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -1016,7 +1196,7 @@ BrowserAppCorePrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreClose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreClose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -1064,7 +1244,7 @@ BrowserAppCoreClose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreExit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreExit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -1112,7 +1292,7 @@ BrowserAppCoreExit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreFind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreFind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -1160,7 +1340,7 @@ BrowserAppCoreFind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool) PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreFindNext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) BrowserAppCoreFindNext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj); nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE; JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL; *rval = JSVAL_NULL;
@ -1239,6 +1419,9 @@ static JSFunctionSpec BrowserAppCoreMethods[] =
{"stop", BrowserAppCoreStop, 0}, {"stop", BrowserAppCoreStop, 0},
{"loadUrl", BrowserAppCoreLoadUrl, 1}, {"loadUrl", BrowserAppCoreLoadUrl, 1},
{"loadInitialPage", BrowserAppCoreLoadInitialPage, 0}, {"loadInitialPage", BrowserAppCoreLoadInitialPage, 0},
{"walletPreview", BrowserAppCoreWalletPreview, 2},
{"cookieViewer", BrowserAppCoreCookieViewer, 1},
{"signonViewer", BrowserAppCoreSignonViewer, 1},
{"walletEditor", BrowserAppCoreWalletEditor, 1}, {"walletEditor", BrowserAppCoreWalletEditor, 1},
{"walletChangePassword", BrowserAppCoreWalletChangePassword, 0}, {"walletChangePassword", BrowserAppCoreWalletChangePassword, 0},
{"walletQuickFillin", BrowserAppCoreWalletQuickFillin, 1}, {"walletQuickFillin", BrowserAppCoreWalletQuickFillin, 1},

Просмотреть файл

@ -528,15 +528,11 @@
function WalletSafeFillin() function WalletSafeFillin()
{ {
var walletCore = XPAppCoresManager.Find("WalletCore"); if (appCore != null) {
if (!walletCore) { dump("Wallet Safe Fillin\n");
walletCore = new WalletCore(); appCore.walletPreview(window, window.frames[0].frames[1]);
if (walletCore) { } else {
walletCore.Init("WalletCore"); dump("BrowserAppCore has not been created!\n");
}
}
if (walletCore) {
walletCore.ShowWindow(window, window.frames[0].frames[1]);
} }
} }
@ -573,29 +569,21 @@
function SignonViewer() function SignonViewer()
{ {
var signonCore = XPAppCoresManager.Find("SignonCore"); if (appCore != null) {
if (!signonCore) { dump("Signon Viewer\n");
signonCore = new SignonCore(); appCore.signonViewer(window);
if (signonCore) { } else {
signonCore.Init("SignonCore"); dump("BrowserAppCore has not been created!\n");
}
}
if (signonCore) {
signonCore.ShowWindow(window);
} }
} }
function CookieViewer() function CookieViewer()
{ {
var cookieCore = XPAppCoresManager.Find("CookieCore"); if (appCore != null) {
if (!cookieCore) { dump("Cookie Viewer\n");
cookieCore = new CookieCore(); appCore.cookieViewer(window);
if (cookieCore) { } else {
cookieCore.Init("CookieCore"); dump("BrowserAppCore has not been created!\n");
}
}
if (cookieCore) {
cookieCore.ShowWindow(window);
} }
} }