[Project_owners] Q: how to access calling XUL window from XPCOM component code?
Malte Kraus
firefox at maltekraus.de
Wed Feb 4 09:39:17 PST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Godmar Back schrieb:
> 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.)
You can use arguments.callee.caller, I think.
> 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?
Sure:
var caller = arguments.callee.caller;
var globalObject = {}.__parent__;
while(caller.__parent__ != globalObject) {
caller = caller.caller;
}
With recursive functions, this loop will never stop though.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmJ0sAACgkQU9AX8TCX8csCwQCfZ7Hc+2Gkdc+2nKG382rOo9Ns
KNgAn3ZUCIGGWBweYK0ts54yLXabvaiR
=5buO
-----END PGP SIGNATURE-----
More information about the Project_owners
mailing list