Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Calling functions in content [was Re: (no subject)]
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nickolay Ponomarev  
View profile  
 More options Oct 27 2006, 11:59 am
Newsgroups: mozilla.dev.extensions
From: "Nickolay Ponomarev" <asquee...@gmail.com>
Date: Fri, 27 Oct 2006 19:59:17 +0400
Local: Fri, Oct 27 2006 11:59 am
Subject: Calling functions in content [was Re: (no subject)]
On 27 Oct 2006 12:48:05 -0000, harish kumar dixit
<harish_dix...@rediffmail.com> wrote:
> I am creating a toolbar for Firefox browser. There is my site on which i have some javascript functions by including some .JS files. Now my problem is that , i m unable to call function on page . I want to know how to call such a function from my toolbar JS file.

It is not recommended to do that, as it may cause security bugs.
XPCNativeWrapper is the security measure preventing you from accessing
JS inside content webpage (see
http://developer.mozilla.org/en/docs/XPCNativeWrapper ).

If you control the webpage, it's better to communicate to it via DOM events.

If you absolutely have to access unsafe JS objects, you can do that
using wrappedJSObject property. It's probably a good idea to avoid
interacting with the page directly from chrome though, run the code in
a sandbox (http://developer.mozilla.org/en/docs/Components.utils.evalInSandbox
) instead. Something like:

var s = Components.utils.Sandbox(content);
s.win = content;
Components.utils.evalInSandbox("win.function()", s);

Nickolay


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.