Hello !
thank you for  your help about javascript, i can execute some scripts from
string texts (JS_evaluateScript).

 Now, i tried to create a new javascript function from a string text and
execute it. This string text contains a script.
And the return value is always "undefined" !  why ??

Here is my sample code (here, there are no parameters to send to the
function) :
aScript_tmp = "var i = '.com'; var a = 'http://'; var KIWI = a+'www.fnac'+i;
KIWI.toString();";
char aScript_tmp2[4096];
strcpy(aScript_tmp2, aScript_tmp);

const char* argnames;
JSFunction* aFunction_ptr = JS_CompileFunction(cx, aGlobalObject, "pop2", 0,
&argnames, aScript_tmp2, strlen(aScript_tmp2), "KIWI_error", lineno);


if (aFunction_ptr == NULL) {
   fprintf(mFichier_sortie,"\n play_script_call() - no function pointer
!!\n");
   fflush(mFichier_sortie);
}else {
   jsval jsargv[2];
  JS_CallFunction(cx, aGlobalObject, aFunction_ptr, 0, jsargv, &rval);
}

Thank you again.
-- 
B�atrice Philippe

[EMAIL PROTECTED]


_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to