diff --git a/xpfe/AppCores/idl/BrowserAppCore.idl b/xpfe/AppCores/idl/BrowserAppCore.idl index 905421b886fc..8528c585ad40 100644 --- a/xpfe/AppCores/idl/BrowserAppCore.idl +++ b/xpfe/AppCores/idl/BrowserAppCore.idl @@ -12,6 +12,7 @@ interface BrowserAppCore : BaseAppCore void walletEditor(); void walletSafeFillin(); void walletQuickFillin(); + void walletSamples(); void setToolbarWindow(in Window win); void setContentWindow(in Window win); diff --git a/xpfe/AppCores/public/nsIDOMBrowserAppCore.h b/xpfe/AppCores/public/nsIDOMBrowserAppCore.h index 84ceaeadede2..0ea207732619 100644 --- a/xpfe/AppCores/public/nsIDOMBrowserAppCore.h +++ b/xpfe/AppCores/public/nsIDOMBrowserAppCore.h @@ -43,6 +43,7 @@ public: NS_IMETHOD WalletEditor()=0; NS_IMETHOD WalletSafeFillin()=0; NS_IMETHOD WalletQuickFillin()=0; + NS_IMETHOD WalletSamples()=0; #endif NS_IMETHOD LoadUrl(const nsString& aUrl)=0; diff --git a/xpfe/AppCores/src/nsBrowserAppCore.cpp b/xpfe/AppCores/src/nsBrowserAppCore.cpp index 07c5dea19695..0d058efae7e8 100644 --- a/xpfe/AppCores/src/nsBrowserAppCore.cpp +++ b/xpfe/AppCores/src/nsBrowserAppCore.cpp @@ -224,6 +224,9 @@ nsBrowserAppCore::Forward() //#define WALLET_EDITOR_URL "http://peoplestage/morse/wallet/walleted.html" #define WALLET_EDITOR_URL "http://people.netscape.com/morse/wallet/walleted.html" +#define WALLET_SAMPLES_URL "http://people.netscape.com/morse/wallet/samples" +//#define WALLET_SAMPLES_URL "http://peoplestage/morse/wallet/samples" + PRInt32 newWindow(char* urlName) { nsresult rv; @@ -271,6 +274,7 @@ newWindow(char* urlName) { controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow, nsnull, nsnull, 615, 650); + NS_RELEASE(url); done: @@ -379,6 +383,15 @@ nsBrowserAppCore::WalletQuickFillin() return NS_OK; } + +NS_IMETHODIMP +nsBrowserAppCore::WalletSamples() +{ + /* bring up the samples in a new window */ + mContentAreaWebShell->LoadURL(nsString(WALLET_SAMPLES_URL), nsnull, nsnull); + return NS_OK; +} + #endif NS_IMETHODIMP diff --git a/xpfe/AppCores/src/nsBrowserAppCore.h b/xpfe/AppCores/src/nsBrowserAppCore.h index 83fcb0334ed2..00835bca673d 100644 --- a/xpfe/AppCores/src/nsBrowserAppCore.h +++ b/xpfe/AppCores/src/nsBrowserAppCore.h @@ -66,6 +66,7 @@ class nsBrowserAppCore : public nsBaseAppCore, NS_IMETHOD WalletEditor(); NS_IMETHOD WalletSafeFillin(); NS_IMETHOD WalletQuickFillin(); + NS_IMETHOD WalletSamples(); #endif NS_IMETHOD LoadUrl(const nsString& aUrl); diff --git a/xpfe/AppCores/src/nsJSBrowserAppCore.cpp b/xpfe/AppCores/src/nsJSBrowserAppCore.cpp index 3aa9079182c9..da9c1f121a79 100644 --- a/xpfe/AppCores/src/nsJSBrowserAppCore.cpp +++ b/xpfe/AppCores/src/nsJSBrowserAppCore.cpp @@ -294,6 +294,39 @@ BrowserAppCoreWalletQuickFillin(JSContext *cx, JSObject *obj, uintN argc, jsval return JS_TRUE; } + + +// +// Native method WalletSamples +// +PR_STATIC_CALLBACK(JSBool) +BrowserAppCoreWalletSamples(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->WalletSamples()) { + return JS_FALSE; + } + + *rval = JSVAL_VOID; + } + else { + JS_ReportError(cx, "Function walletSamples requires 0 parameters"); + return JS_FALSE; + } + + return JS_TRUE; +} #endif @@ -701,6 +734,7 @@ static JSFunctionSpec BrowserAppCoreMethods[] = {"walletEditor", BrowserAppCoreWalletEditor, 0}, {"walletSafeFillin", BrowserAppCoreWalletSafeFillin, 0}, {"walletQuickFillin", BrowserAppCoreWalletQuickFillin, 0}, + {"walletSamples", BrowserAppCoreWalletSamples, 0}, #endif {"loadUrl", BrowserAppCoreLoadUrl, 1}, {"setToolbarWindow", BrowserAppCoreSetToolbarWindow, 1}, diff --git a/xpfe/browser/src/navigator.xul b/xpfe/browser/src/navigator.xul index ce0ee395f43e..9c2f98684684 100644 --- a/xpfe/browser/src/navigator.xul +++ b/xpfe/browser/src/navigator.xul @@ -283,6 +283,17 @@ } } + function WalletSamples() + { + appCore = XPAppCoresManager.Find("BrowserAppCore"); + if (appCore != null) { + dump("Wallet Samples\n"); + appCore.walletSamples(); + } else { + dump("BrowserAppCore has not been created!\n"); + } + } + @@ -443,6 +454,8 @@ + +