diff --git a/mozilla/extensions/python/xpcom/client/__init__.py b/mozilla/extensions/python/xpcom/client/__init__.py index 8dfe0b6cea1..34820ae4fec 100644 --- a/mozilla/extensions/python/xpcom/client/__init__.py +++ b/mozilla/extensions/python/xpcom/client/__init__.py @@ -152,9 +152,6 @@ class _XPCOMBase: def __hash__(self): return hash(self._comobj_) - def __repr__(self): - return "" % (self._object_name_,) - # See if the object support strings. def __str__(self): try: @@ -328,8 +325,15 @@ class Component(_XPCOMBase): # We can advantage from nsIClassInfo - use it. if not self._tried_classinfo_: self._build_all_supported_interfaces_() - return _XPCOMBase.__repr__(self) - + assert self._tried_classinfo_, "Should have tried the class info by now!" + infos = self.__dict__['_interface_infos_'] + if infos: + iface_names = ",".join([iid.name for iid in infos.keys()]) + iface_desc = " (implementing %s)" % (iface_names,) + else: + iface_desc = " (with no class info)" + return "" % (self._object_name_,iface_desc) + class _Interface(_XPCOMBase): def __init__(self, comobj, iid, method_infos, getters, setters, constants): self.__dict__['_comobj_'] = comobj @@ -393,6 +397,9 @@ class _Interface(_XPCOMBase): real_param_infos = ( param_infos, (val,) ) return XPTC_InvokeByIndex(self, method_index, real_param_infos) + def __repr__(self): + return "" % (self._object_name_,) + # Called by the _xpcom C++ framework to wrap interfaces up just # before they are returned.