mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
add Interface implementation for JS stubs in messenger
This commit is contained in:
parent
ae7cb5ad7a
commit
fbd846dbce
@ -49,6 +49,10 @@ CPPSRCS = \
|
||||
nsMsgMD5.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS += \
|
||||
nsIMessenger.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -28,6 +28,7 @@ DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPPSRCS= \
|
||||
nsMessenger.cpp \
|
||||
nsIMessenger.cpp \
|
||||
nsMessengerNameSet.cpp \
|
||||
nsMsgRFC822Parser.cpp \
|
||||
nsUInt32Array.cpp \
|
||||
@ -42,6 +43,7 @@ CPPSRCS= \
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsMessenger.obj \
|
||||
.\$(OBJDIR)\nsIMessenger.obj \
|
||||
.\$(OBJDIR)\nsMessengerNameSet.obj \
|
||||
.\$(OBJDIR)\nsMsgRFC822Parser.obj \
|
||||
.\$(OBJDIR)\nsUInt32Array.obj \
|
||||
|
69
mailnews/base/src/nsIMessenger.cpp
Normal file
69
mailnews/base/src/nsIMessenger.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* DO NOT EDIT. THIS FILE IS GENERATED FROM nsIMessenger.idl
|
||||
*/
|
||||
#include "jsapi.h"
|
||||
#include "nsIMessenger.h"
|
||||
|
||||
static char XXXnsresult2string_fmt[] = "XPCOM error %#x";
|
||||
#define XXXnsresult2string(res) XXXnsresult2string_fmt, res
|
||||
|
||||
static void
|
||||
nsIMessenger_Finalize(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsIMessenger *priv = (nsIMessenger *)JS_GetPrivate(cx, obj);
|
||||
if (!priv)
|
||||
return;
|
||||
JSObject *globj = JS_GetGlobalObject(cx);
|
||||
if (globj)
|
||||
(void) JS_DeleteElement(cx, globj, (jsint)priv >> 1);
|
||||
NS_RELEASE(priv);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
nsIMessenger_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSClass nsIMessenger_class = {
|
||||
"nsIMessenger",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nsIMessenger_Finalize
|
||||
};
|
||||
|
||||
#ifdef XPIDL_JS_STUBS
|
||||
JSObject *
|
||||
nsIMessenger::InitJSClass(JSContext *cx)
|
||||
{
|
||||
JSObject *globj = JS_GetGlobalObject(cx);
|
||||
if (!globj)
|
||||
return 0;
|
||||
JSObject *proto = JS_InitClass(cx, globj, 0, &nsIMessenger_class, nsIMessenger_ctor, 0,
|
||||
0, 0, 0, 0);
|
||||
return proto;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
nsIMessenger::GetJSObject(JSContext *cx, nsIMessenger *priv)
|
||||
{
|
||||
JSObject *globj = JS_GetGlobalObject(cx);
|
||||
if (!globj)
|
||||
return 0;
|
||||
jsval v;
|
||||
if (!JS_LookupElement(cx, globj, (jsint)priv >> 1, &v))
|
||||
return 0;
|
||||
if (JSVAL_IS_VOID(v)) {
|
||||
JSObject *obj = JS_NewObject(cx, &nsIMessenger_class, 0, 0);
|
||||
if (!obj || !JS_SetPrivate(cx, obj, priv))
|
||||
return 0;
|
||||
NS_ADDREF(priv);
|
||||
v = PRIVATE_TO_JSVAL(obj);
|
||||
if (!JS_DefineElement(cx, globj, (jsint)priv >> 1, v, 0, 0,
|
||||
JSPROP_READONLY | JSPROP_PERMANENT)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return (JSObject *)JSVAL_TO_PRIVATE(v);
|
||||
}
|
||||
#endif /* XPIDL_JS_STUBS */
|
@ -53,7 +53,7 @@ nsMessengerNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
||||
|
||||
printf("nsMessengerNameSet::InitializeClasses() Initializing base classes\n");
|
||||
#ifdef XPIDL_JS_STUBS
|
||||
rv = nsIMessenger::InitJSClass(cx);
|
||||
nsIMessenger::InitJSClass(cx);
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user