Ok, I could reproduce the problem. I suggest that you move your Listener into a JS XPCOM component. That's easy to do, and it should fix the problem.

See http://lxr.mozilla.org/mozilla/source/xpcom/sample/nsSample.js

-Darin


Ludovic LANGE wrote:

Darin Fisher wrote:

It looks like you are using nsIDNSService correctly, but I don't see how you are hooking this code up to the rest of Firefox. You said that you based your code on nsSample.js, but I don't see the code here that handles XPCOM component registration. Feel free to attach a complete example, and I'll help debug.

-Darin

You'll find the extension plus source code here : http://moztest.lange.nom.fr/XPI/
Please read the rest of the post below for special recommendations.


You're right I'm not registering the component to the rest of FireFox as I thought it wasn't needed (as my component is local and doesn't need to be accessed by it name, etc..). I may be wrong, but Christian seems to agree ? I couldn't find any documentation on this specific item.



Christian Biesinger wrote:

On Wed, Oct 20, 2004 at 08:37:00PM +0200, Ludovic LANGE wrote:

...

netscape.public.mozilla.netlib would be a better place to ask for
nsIDNSService/nsIDNSListener specifically; this one is ok for general
xpcom questions.

I'm also posting to this newsgroup, thanks.

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)...

(I'm also open to any other remarks...)


When you say "hang", what do you mean? That ffox doesn't redraw itself
and doesn't react to keypresses/mouseclicks?

Exactly. The only way then is to kill the process (sending Ctrl+C to the console for example)


throw Components.results.NS_NOINTERFACE;
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;



The lines after the throw are unreachable.

You're right and it's corrected now.

if( this._thumb && aStatus ) {



You should check Component.isSuccessCode(aStatus) rather than aStatus itself, since there are more success codes than NS_OK (0).

Done,

    var dns = see_DNS();
    if( dns ) {



This will never be null, since getService throws an exception when it fails to get the service.

Ok,

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.

Tried.

Do you get any output in JS Console?

No, nothing there. Perhaps the hang is too quick for the content to appear.



I've set up a test case here : http://moztest.lange.nom.fr/XPI/

There you'll find the extension ( http://moztest.lange.nom.fr/XPI/test.xpi ) and the source code in unpackaged form.

You can download the extension and try it by yourself, be carefull as it is set to start only when the following url ( http://www.mozilla.org/ ) is accessed (thus enabling me to have a non-hanging FireFox when accessing others urls).
So :
1) install extension, restart FireFox with console,
2) click on (or access) http://www.mozilla.org/
3) FF1.0 PR hangs, after writing my dumps on the console.



Thank you for your time gentlemen.

Regards,

Ludovic LANGE.
_______________________________________________
Mozilla-netlib mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-netlib


_______________________________________________
Mozilla-netlib mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-netlib

Reply via email to