May be this example will help,
http://lxr.mozilla.org/seamonkey/source/xpfe/browser/src/nsBrowserInstance.cpp#1465
navneet kumar wrote:
> I have written a C++ XPCOM object. I would like to call a javascript
> function from this object. JavaScript function is defined in html page
> hosting XPCOM object.
>
> In other words, I am looking for something equivalent to the following
> in IE
> pIHTMLWindow->execScript(bstrScript,NULL,&vtResult);
>
> where bstrScript has JavaScript function name defined in html page.
>
> Navneet