On Wed, Oct 20, 2004 at 08:37:00PM +0200, Ludovic LANGE wrote:
> Forgive me if it's not the right place to ask. I am trying to use the
> dns-service from an extension (XPI), and while the 'resolve' method is
> working as it should, using the 'asyncResolve' leads to FireFox hanging.
netscape.public.mozilla.netlib would be a better place to ask for
nsIDNSService/nsIDNSListener specifically; this one is ok for general
xpcom questions.
> I have no experience in writing listener (XPCom components in
> Javascript) and most of my inspiration comes from
> lxr.mozilla.org/seamonkey/source/xpcom/sample/nsSample.js concerning the
> 'listener' variable.
This looks fine.
> However, I don't know if I must 'register' this new component to XPCom,
> or if passing the variable 'listener' to the asyncResolve procedure is
> enough.
No, only components that want to be available via Components.classes
need to register.
> If there is nothing obviously wrong with this code, can you point me
> towards any ressource that could help me going forward on this subject ?
I can't see anything wrong with the code (that would affect your
problem)...
When you say "hang", what do you mean? That ffox doesn't redraw itself
and doesn't react to keypresses/mouseclicks?
> throw Components.results.NS_NOINTERFACE;
> Components.returnCode =
> Components.results.NS_ERROR_NO_INTERFACE;
> return null;
The lines after the throw are unreachable.
> if( this._thumb && aStatus ) {
You should check Component.isSuccessCode(aStatus) rather than aStatus
itself, since there are more success codes than NS_OK (0).
> var dns = see_DNS();
> if( dns ) {
This will never be null, since getService throws an exception when it
fails to get the service.
> ip = dns.asyncResolve( domain, false,
> listener, null );
The second arg is no longer a boolean argument (not since 2004-09-01
12:55 on the branch; the first release to contain this change is
1.0PR1). Try passing 0.
Do you get any output in JS Console?
--
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom