see: http://www.mozilla.org/scriptable/xptcall-faq.html and http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html