Calling content functions from chrome

[email protected]
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <08de9582-6a24-4d41-bc31-8bc6c81c4fc8@z70g2000hsb.googlegroups.com>
Hi,

I would like to call functions in web pages from chrome.
As far as I understand doing this by accessing the functions from the
wrappedJSObject is a bad idea. (http://groups.google.com/group/
mozilla.dev.tech.dom/browse_thread/thread/c967e58737e2e0f8/
a958f3f04f17de35?#a958f3f04f17de35)

So, I thought on doing it like this:
  * When the page loads create an hidden div inside it
  * Add event listener on this div to listen to a custom event
  * When I want to call a function in the web page from my extension
I'll set a property on the div with the function name and send the
custom event to the div (e.g. the div will have property called
funcToEval with the value "testFunc();")
  * When the div get the event, the event listener would read the
property with the function name and eval it

As far as I know in this way the function will be evaluated in the web
page context and wont be able to get any special privileges.

Are there any securities issues with this? Is there any easier way of
doing this?

Thanks,
Nimrod
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.