Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   executing javascript from an embedded gecko (http://www.velocityreviews.com/forums/t928674-executing-javascript-from-an-embedded-gecko.html)

philippe 12-12-2006 09:51 AM

executing javascript from an embedded gecko
 
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,theGlobalJSObjec t,script_PA,strlen(script_PA),"script",lineno,&rev al);

}

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



All times are GMT. The time now is 07:35 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.