views:

14

answers:

0

CAN'T REPRODUCE ANYMORE


The code below works fine when there is internet connection.

var socket = Cc["@mozilla.org/network/server-socket;1"]
                 .createInstance(Ci.nsIServerSocket);
socket.init(-1, true, -1);
socket.asyncListen(nsIServerSocketBug);

However once the computer is disconnected from the internet, I get

Error: Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIServerSocket.asyncListen]


Reproducing

(I'm using Firefox 3.6.11 on Ubuntu)

A minimal version of the extension reproducing this problem can be found at http://www.mediafire.com/file/4lxb9df857g8lr6/nsIServerSocketBug.xpi

The file to look at is chrome/content/main.js.

Open Tools > Error Console to see the instructions and output of the extension.

The instructions are:

  1. On every page load this extension initializes a server socket by calling nsIServerSocketBug.createSocket() method (the code above). Try reloading some page a few times to see that it works.
  2. Now close firefox and launch it again.
  3. Try reloading some page a few times again, the sockets work.
  4. Now disconnect from the internet and try reloading again. It shouldn't work anymore.

ALSO NOTE, that if you delete compreg.dat file from your firefox profile, the first time you launch Firefox, the socket creation will work even when you're online and offline. Only when you launch it second time it stops working offline.