executing javascript from an embedded gecko

Discussion in 'Javascript' started by philippe, Dec 12, 2006.

  1. philippe

    philippe Guest

    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
    philippe, Dec 12, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    1
    Views:
    326
    gaidar
    Apr 4, 2005
  2. Nicholas Smith

    khtml or gecko for java

    Nicholas Smith, Aug 19, 2003, in forum: Java
    Replies:
    2
    Views:
    916
    Nicholas Smith
    Aug 20, 2003
  3. Samuël van Laere

    Gecko layout engines

    Samuël van Laere, Jul 23, 2003, in forum: HTML
    Replies:
    1
    Views:
    388
    David Dorward
    Jul 23, 2003
  4. Peter Bremer
    Replies:
    11
    Views:
    839
    nice.guy.nige
    Jul 30, 2003
  5. Peter Bremer
    Replies:
    14
    Views:
    188
    Lasse Reichstein Nielsen
    Jul 30, 2003
Loading...

Share This Page