With gecko 1.8 I used the following code

    nsCOMPtr<nsIScriptGlobalObjectOwner>
theGlobalObjectOwner(do_GetInterface(mWebBrowser));
    Trace::write(deep_Trace,"WebBrowserChrome::executeScript");

    if (theGlobalObjectOwner)
    {
        nsIScriptGlobalObject* theGlobalObject;
        theGlobalObject=theGlobalObjectOwner-
>GetScriptGlobalObject(); // NOW thGlobalObject is NULL

                if (theGlobalObject)
                {
                        nsIScriptContext* theScriptContext = 
theGlobalObject->GetContext();

                        UnicodeString unicodeScript = 
UnicodeString::fromLatin1(aScript);
                        nsAutoString script((wchar_t*)unicodeScript.data());

                        //todo: fuite mémoire (memory leak)
                        PRBool        IsUndefined;
                        Trace::write(deep_Trace,"WebBrowserChrome
executeScript(%s)",aScript.c_str());

                        theScriptContext->EvaluateString(script,
                                                                                
         nsnull,
                                                                                
         nsnull,
                                                                                
         "",
                                                                                
         1,
                                                                                
         nsnull,
                                                                                
         nsnull,
                                                                                
         &IsUndefined);
                }
                else
                {
                        return false;
                        }
    }

    return true;
}


But with 1.9.2.23  theGlobalObject returned  by theGlobalObjectOwner-
>GetScriptGlobalObject();  is null

How can I get  a valid nsScriptGlobalObject.. Did the architecture of
the classes change ?

Is there a documentation about the architecture. I have
http://doxygen.db48x.net/mozilla-full/html/index.html, but it's very
deep!!!!

Thank's a lot for your responses

philippe
_______________________________________________
dev-embedding mailing list
dev-embedding@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to