This commit is contained in:
putterman%netscape.com 1999-03-22 22:34:43 +00:00
Родитель bf82500ce5
Коммит cc444a085e
4 изменённых файлов: 55 добавлений и 0 удалений

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

@ -48,6 +48,9 @@ class nsIDOMMsgAppCore : public nsIDOMBaseAppCore {
/* void GetRDFResourceForMessage (in string str); */
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree, nsIDOMNodeList *nodeList, nsISupports **_retval) = 0;
/* void exit(); */
NS_IMETHOD Exit()= 0;
#ifdef XPIDL_JS_STUBS
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIDOMMsgAppCore *priv);

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

@ -51,6 +51,7 @@ interface nsIDOMMsgAppCore : nsIDOMBaseAppCore {
void OpenURL(in string str);
void DeleteMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
nsISupports GetRDFResourceForMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
void Exit();
};
/* hack to make MsgAppCore visible from AppCore */

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

@ -383,7 +383,33 @@ MsgAppCoreGetRDFResourceForMessage(JSContext *cx, JSObject *obj, uintN argc, jsv
return JS_TRUE;
}
//
// Native method Exit
//
PR_STATIC_CALLBACK(JSBool)
MsgAppCoreExit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMMsgAppCore *nativeThis = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeList *nodeList;
nsIDOMXULTreeElement *tree;
nsISupports *nativeRet;
const nsString typeName;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (NS_OK != nativeThis->Exit())
{
return JS_FALSE;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for MsgAppCore
@ -422,6 +448,7 @@ static JSFunctionSpec MsgAppCoreMethods[] =
{"OpenURL", MsgAppCoreOpenURL, 1},
{"DeleteMessage", MsgAppCoreDeleteMessage, 2},
{"GetRDFResourceForMessage", MsgAppCoreGetRDFResourceForMessage, 2},
{"exit", MsgAppCoreExit, 0},
{0}
};

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

@ -51,6 +51,10 @@
#include "nsIRDFResource.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
#include "nsIAppShell.h"
#include "nsIAppShellService.h"
#include "nsAppShellCIDs.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_CID(kCMailboxServiceCID, NS_MAILBOXSERVICE_CID);
@ -58,6 +62,8 @@ static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
NS_BEGIN_EXTERN_C
@ -94,6 +100,7 @@ public:
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
nsIDOMNodeList *nodeList, nsISupports
**aSupport);
NS_IMETHOD Exit();
private:
@ -571,6 +578,23 @@ nsMsgAppCore::GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
return rv;
}
NS_IMETHODIMP
nsMsgAppCore::Exit()
{
nsIAppShellService* appShell = nsnull;
/*
* Create the Application Shell instance...
*/
nsresult rv = nsServiceManager::GetService(kAppShellServiceCID,
nsIAppShellService::GetIID(),
(nsISupports**)&appShell);
if (NS_SUCCEEDED(rv)) {
appShell->Shutdown();
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
}
return NS_OK;
}
// to load the webshell!
// mWebShell->LoadURL(nsAutoString("http://www.netscape.com"),