On Thu, Oct 24, 2013 at 5:34 PM, Vasu Yadav <vasuyadavkri...@gmail.com>wrote:

> My plan is to pass a nsIDocShell pointer to javascript component and then
> let the javascript component execute the given javascript in a content
> window. ex. get/set window property, call a global function in window
>

- how can I find a global window object for a nsIDocshell in my javascript
> XPCOM component
>

I would suggest passing the nsIDOMWindow directly, which you can get doing:
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(docshell);

- how can I execute a javascript in that window
>

win.wrappedJSObject.eval('script');

Note that the use of .wrappedJSObject here means that sneaky content could
redefine eval() to something else. But I doubt that's a problem for you.

bholley
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to