script problem
philippe <[email protected]> Fri, 2 Dec 2011 05:40:40 -0800 (PST)
| Newsgroups | gmane.comp.mozilla.devel.embedding |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <67eec861-70b7-4db5-9cb9-a5ec27a11092@z12g2000yqm.googlegroups.com> |
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