[Project_owners] Q: how to access calling XUL window from XPCOM component code?

Malte Kraus firefox at maltekraus.de
Sat Feb 7 16:43:40 PST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Godmar Back schrieb:
> Turns out this approach is not very useful since 'caller' appears to
> be defined only if the calling function is defined via a 'function
> name() { }' statement.  If the calling function is defined via
> variable assignment as in name = function (), or if the call occurs in
> a top-level context, caller is null and no parent property can be
> obtained.
Yes, this is approach is rather limited. However, you can also write
function assignments like this:
name = function name() {};

> Aside from that, I don't understand the intent of "caller.__parent__
> != globalObject" - are you trying to walk up the call chain until the
> function's __parent__ is equal to the current function's global
> object?
I actually meant "==" instead of "!=", which would walk up the call
chain until a caller from another window (or component) is found.

- --
Malte Kraus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmOKrYACgkQU9AX8TCX8csEvgCgkyxOylfkUu/cIBcXTiDCJouv
0PMAoIzakgTvS8mOOwgpjdi+EWh/dXJr
=gTs5
-----END PGP SIGNATURE-----


More information about the Project_owners mailing list