From 4122bd5df95db0a6e5b77896d28ca888e79a1f2c Mon Sep 17 00:00:00 2001 From: "ducarroz%netscape.com" Date: Tue, 27 Apr 1999 21:28:44 +0000 Subject: [PATCH] Add args parameter to NewMessage to solve multiple appcores problem --- mailnews/compose/src/nsJSComposeAppCore.cpp | 35 +++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/mailnews/compose/src/nsJSComposeAppCore.cpp b/mailnews/compose/src/nsJSComposeAppCore.cpp index 21763669ed0..1d831009355 100644 --- a/mailnews/compose/src/nsJSComposeAppCore.cpp +++ b/mailnews/compose/src/nsJSComposeAppCore.cpp @@ -261,10 +261,11 @@ ComposeAppCoreNewMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj); JSBool rBool = JS_FALSE; nsAutoString b0; - nsIDOMXULTreeElement * b1; - nsIDOMNodeList * b2; - nsIDOMMsgAppCore * b3; - PRInt32 b4; + nsAutoString b1; + nsIDOMXULTreeElement * b2; + nsIDOMNodeList * b3; + nsIDOMMsgAppCore * b4; + PRInt32 b5; int32 i; const nsString typeName; @@ -275,36 +276,38 @@ ComposeAppCoreNewMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, return JS_TRUE; } - if (argc >= 5) { + if (argc >= 6) { nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); - rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsIDOMXULTreeElement::GetIID(), - typeName, - cx, - argv[1]); + nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]); - rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b2, nsIDOMNodeList::GetIID(), + rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b2, nsIDOMXULTreeElement::GetIID(), typeName, cx, argv[2]); - rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b3, nsIDOMMsgAppCore::GetIID(), + rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b3, nsIDOMNodeList::GetIID(), typeName, cx, argv[3]); - JS_ValueToInt32(cx, argv[4], &i); - b4 = 1; + rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b4, nsIDOMMsgAppCore::GetIID(), + typeName, + cx, + argv[4]); - if (!rBool || NS_OK != nativeThis->NewMessage(b0, b1, b2, b3, b4)) { + JS_ValueToInt32(cx, argv[5], &i); + b5 = i; + + if (!rBool || NS_OK != nativeThis->NewMessage(b0, b1, b2, b3, b4, b5)) { return JS_FALSE; } *rval = JSVAL_VOID; } else { - JS_ReportError(cx, "Function NewMessage requires 5 parameters"); + JS_ReportError(cx, "Function NewMessage requires 6 parameters"); return JS_FALSE; } @@ -427,7 +430,7 @@ static JSFunctionSpec ComposeAppCoreMethods[] = {"SetWindow", ComposeAppCoreSetWindow, 1}, {"SetEditor", ComposeAppCoreSetEditor, 1}, {"CompleteCallback", ComposeAppCoreCompleteCallback, 1}, - {"NewMessage", ComposeAppCoreNewMessage, 5}, + {"NewMessage", ComposeAppCoreNewMessage, 6}, {"SendMessage", ComposeAppCoreSendMessage, 5}, {"SendMessage2", ComposeAppCoreSendMessage2, 0}, {0}