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