Add args parameter to NewMessage to solve multiple appcores problem

This commit is contained in:
ducarroz%netscape.com 1999-04-27 21:28:44 +00:00
Родитель 1f126273fa
Коммит 4122bd5df9
1 изменённых файлов: 19 добавлений и 16 удалений

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

@ -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}