opensubscriber
   Find in this group all groups
 
Unknown more information…

m : mozilla-xpcom@mozilla.org 9 January 2006 • 8:28PM -0500

Re: How to add extra property to "window" object
by David Huynh

REPLY TO AUTHOR
 
REPLY TO GROUP




Mook wrote:
> David Huynh wrote:
>
>> Hi all,
>>
>> I'm trying to write a Firefox extension that adds an extra property to
>> the "window" object that Web pages' scripts have access to. As you
>> know, currently, scripts in Web pages can access such objects as
>>
>>     window
>>     window.document
>>     window.navigator
>>     window.netscape
>>     ...
>>
>> I'd like to add my own property onto this window object that all Web
>> pages' scripts can access
>>
>>     window.foo
>>
>> I will provide the implementation of foo as necessary. I'm hoping that
>> someone here can tell me how to do this. I've tried a number of
>> methods (such as overloading the <browser> XBL binding), but I don't
>> see how to do this cleanly from within an extension.
>>
>> The major issue is probably security. And I can't require every Web
>> page that wants to use this object to be signed so that it can request
>> privileges.
>>
>> Many thanks in advance!
>>
>> David
>
>
>
> (I'm ignoring the .jseng copy of this exact same message)
>
> One options is to do what window.sidebar does it at
> http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/browser/components/sidebar/src/nsSidebar.js&rev=1.11#228
>   I think.  I'm hoping whatever window.sidebar does is secure - so you
> probably need to look at its nsIClassInfo impl too :)
>

Awesome! Many thanks!

David
_______________________________________________
Mozilla-xpcom mailing list
Mozilla-xpcom@mozi...
http://mail.mozilla.org/listinfo/mozilla-xpcom

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.