[Project_owners] Q: how to access calling XUL window from XPCOM component code?
Godmar Back
godmar at gmail.com
Wed Feb 4 09:14:28 PST 2009
On Wed, Feb 4, 2009 at 8:59 AM, Malte Kraus <firefox at maltekraus.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Godmar Back schrieb:
>> Would anybody happen to know how I can access/find out the calling XUL
>> window within a method defined in global component code? (I could pass
>> in 'window' into each method, but I'm hoping for a simpler way.)
> As long as the caller used wrappedJSObject, you can do this:
>
> function name() {
> var win = name.caller.__parent__;
> }
Thank you!
Is it possible to walk the stack in some way in case the function is
called indirectly along a chain of calls, as in
'name.caller.caller....' until a __parent__ property is found?
Also, can name.caller be replaced with arguments.caller? (I find
conflicting information in MDC - it says that arguments.caller is no
longer supported for security reasons, though this wouldn't make sense
for XUL code.)
- Godmar
More information about the Project_owners
mailing list