зеркало из https://github.com/mozilla/pjs.git
remove wallet-related stuff from appcores
This commit is contained in:
Родитель
f4e4f112db
Коммит
8ec7170a2f
|
@ -21,7 +21,7 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
|
||||
DIRS=public src editor
|
||||
DIRS=public src editor signonviewer cookieviewer walletpreview
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
DEPTH=..\..
|
||||
|
||||
DIRS=public src editor
|
||||
DIRS=public src editor signonviewer cookieviewer walletpreview
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -11,6 +11,9 @@ interface BrowserAppCore : BaseAppCore
|
|||
void loadUrl(in wstring url);
|
||||
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 walletChangePassword();
|
||||
void walletQuickFillin(in Window win);
|
||||
|
|
|
@ -45,6 +45,12 @@ public:
|
|||
|
||||
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 WalletChangePassword()=0;
|
||||
|
@ -85,6 +91,9 @@ public:
|
|||
NS_IMETHOD Stop(); \
|
||||
NS_IMETHOD LoadUrl(const nsString& aUrl); \
|
||||
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 WalletChangePassword(); \
|
||||
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); \
|
||||
|
@ -110,6 +119,9 @@ public:
|
|||
NS_IMETHOD Stop() { return _to Stop(); } \
|
||||
NS_IMETHOD LoadUrl(const nsString& aUrl) { return _to LoadUrl(aUrl); } \
|
||||
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 WalletChangePassword() { return _to WalletChangePassword(); } \
|
||||
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin) { return _to WalletQuickFillin(aWin); } \
|
||||
|
|
|
@ -461,33 +461,188 @@ nsBrowserAppCore::WalletEditor(nsIDOMWindow* aWin)
|
|||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef xxx
|
||||
/* set a cookie for the wallet editor */
|
||||
nsIWalletService *walletservice;
|
||||
NS_IMETHODIMP
|
||||
nsBrowserAppCore::SignonViewer(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-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;
|
||||
res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&walletservice);
|
||||
nsFileSpec dirSpec;
|
||||
nsresult rv = ProfileDirectory(dirSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsFileURL u = nsFileURL(dirSpec + WALLET_EDITOR_NAME);
|
||||
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);
|
||||
nsString urlString = nsString("");
|
||||
if (webcontent) {
|
||||
const PRUnichar *url = 0;
|
||||
PRInt32 history;
|
||||
res = webcontent->GetHistoryIndex(history);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = webcontent->GetURL( history, &url );
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
urlString = nsString(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* bring up the wallet editor in a new window */
|
||||
return newWind((char *)(u.GetURLString()));
|
||||
#endif
|
||||
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_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
|
||||
|
|
|
@ -67,6 +67,9 @@ class nsBrowserAppCore : public nsBaseAppCore,
|
|||
NS_IMETHOD Forward();
|
||||
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 WalletChangePassword();
|
||||
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin);
|
||||
|
|
|
@ -52,7 +52,7 @@ NS_DEF_PTR(nsIDOMWindow);
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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 (nsnull == a) {
|
||||
|
@ -62,7 +62,7 @@ GetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ GetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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 (nsnull == a) {
|
||||
|
@ -97,7 +97,7 @@ SetBrowserAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsIScriptSecurityManager *secMan;
|
||||
PRBool ok;
|
||||
PRBool ok = PR_FALSE;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ ResolveBrowserAppCore(JSContext *cx, JSObject *obj, jsval id)
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -200,7 +200,7 @@ BrowserAppCoreBack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -248,7 +248,7 @@ BrowserAppCoreForward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -296,7 +296,7 @@ BrowserAppCoreStop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
nsAutoString b0;
|
||||
|
||||
|
@ -347,7 +347,7 @@ BrowserAppCoreLoadUrl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*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
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
nsIDOMWindowPtr b0;
|
||||
|
||||
|
@ -452,7 +632,7 @@ BrowserAppCoreWalletEditor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -500,7 +680,7 @@ BrowserAppCoreWalletChangePassword(JSContext *cx, JSObject *obj, uintN argc, jsv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
nsIDOMWindowPtr b0;
|
||||
|
||||
|
@ -557,7 +737,7 @@ BrowserAppCoreWalletQuickFillin(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -605,7 +785,7 @@ BrowserAppCoreWalletSamples(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
nsIDOMWindowPtr b0;
|
||||
|
||||
|
@ -662,7 +842,7 @@ BrowserAppCoreSetToolbarWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
nsIDOMWindowPtr b0;
|
||||
|
||||
|
@ -719,7 +899,7 @@ BrowserAppCoreSetContentWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
nsIDOMWindowPtr b0;
|
||||
|
||||
|
@ -776,7 +956,7 @@ BrowserAppCoreSetWebShellWindow(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -824,7 +1004,7 @@ BrowserAppCoreNewWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -872,7 +1052,7 @@ BrowserAppCoreOpenWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -920,7 +1100,7 @@ BrowserAppCorePrintPreview(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -968,7 +1148,7 @@ BrowserAppCoreCopy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -1016,7 +1196,7 @@ BrowserAppCorePrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -1064,7 +1244,7 @@ BrowserAppCoreClose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -1112,7 +1292,7 @@ BrowserAppCoreExit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -1160,7 +1340,7 @@ BrowserAppCoreFind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
PR_STATIC_CALLBACK(JSBool)
|
||||
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;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -1239,6 +1419,9 @@ static JSFunctionSpec BrowserAppCoreMethods[] =
|
|||
{"stop", BrowserAppCoreStop, 0},
|
||||
{"loadUrl", BrowserAppCoreLoadUrl, 1},
|
||||
{"loadInitialPage", BrowserAppCoreLoadInitialPage, 0},
|
||||
{"walletPreview", BrowserAppCoreWalletPreview, 2},
|
||||
{"cookieViewer", BrowserAppCoreCookieViewer, 1},
|
||||
{"signonViewer", BrowserAppCoreSignonViewer, 1},
|
||||
{"walletEditor", BrowserAppCoreWalletEditor, 1},
|
||||
{"walletChangePassword", BrowserAppCoreWalletChangePassword, 0},
|
||||
{"walletQuickFillin", BrowserAppCoreWalletQuickFillin, 1},
|
||||
|
|
|
@ -528,15 +528,11 @@
|
|||
|
||||
function WalletSafeFillin()
|
||||
{
|
||||
var walletCore = XPAppCoresManager.Find("WalletCore");
|
||||
if (!walletCore) {
|
||||
walletCore = new WalletCore();
|
||||
if (walletCore) {
|
||||
walletCore.Init("WalletCore");
|
||||
}
|
||||
}
|
||||
if (walletCore) {
|
||||
walletCore.ShowWindow(window, window.frames[0].frames[1]);
|
||||
if (appCore != null) {
|
||||
dump("Wallet Safe Fillin\n");
|
||||
appCore.walletPreview(window, window.frames[0].frames[1]);
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,29 +569,21 @@
|
|||
|
||||
function SignonViewer()
|
||||
{
|
||||
var signonCore = XPAppCoresManager.Find("SignonCore");
|
||||
if (!signonCore) {
|
||||
signonCore = new SignonCore();
|
||||
if (signonCore) {
|
||||
signonCore.Init("SignonCore");
|
||||
}
|
||||
}
|
||||
if (signonCore) {
|
||||
signonCore.ShowWindow(window);
|
||||
if (appCore != null) {
|
||||
dump("Signon Viewer\n");
|
||||
appCore.signonViewer(window);
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function CookieViewer()
|
||||
{
|
||||
var cookieCore = XPAppCoresManager.Find("CookieCore");
|
||||
if (!cookieCore) {
|
||||
cookieCore = new CookieCore();
|
||||
if (cookieCore) {
|
||||
cookieCore.Init("CookieCore");
|
||||
}
|
||||
}
|
||||
if (cookieCore) {
|
||||
cookieCore.ShowWindow(window);
|
||||
if (appCore != null) {
|
||||
dump("Cookie Viewer\n");
|
||||
appCore.cookieViewer(window);
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче