executing javascript from an embedded gecko

P

philippe

Hello

I loaded a page from an embedded page.

I want to execute a script

here is my code

nsCOMPtr<nsIScriptGlobalObjectOwner>
theGlobalObjectOwner(do_GetInterface(mWebBrowser));
if (theGlobalObjectOwner) {
JSFunction* jsf;
nsIScriptGlobalObject *theGlobalObject ;

theGlobalObjectOwner->GetScriptGlobalObject(&theGlobalObject);
nsIScriptContext *theScriptContext
=theGlobalObject->GetContext();

JSObject *theGlobalJSObject =
theGlobalObject->GetGlobalJSObject();
JSContext *theJSContext =
(JSContext*)theScriptContext->GetNativeContext();

const char* script_PA="alert(10);";

jsval reval=0;
uintN lineno=0;
JSBool
ok=JS_EvaluateScript(theJSContext,theGlobalJSObject,script_PA,strlen(script_PA),"script",lineno,&reval);

}

ok is always false and nothing appends.

Do you have , already executed a script into an existing context?

AM I wrong

Thank's for help

philippe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top