Improve error message when a server TCPSocket fails because a port is already used




3 years ago
3 years ago


(Reporter: marco, Unassigned)


Firefox Tracking Flags

(Not tracked)




3 years ago
A call to mozTCPSocket::listen fails if the port is already used. The error logged to the console is quite uninformative ("uncaught exception: out of memory error", or something like this). We should improve this message.

Comment 1

3 years ago
If I run the same code in the privileged about:newtab, I can see the following: [Exception... "Component returned failure code: 0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE) [nsIServerSocket.init]"  nsresult: "0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE)"  location: "JS frame :: resource://gre/components/TCPServerSocket.js :: tss_listen :: line 105"  data: no]
I also ran into this when writing examples for mozTcpSocket.listen. Without this bug I wouldn't have known why I see "out of memory". Is this really so hard to fix that it has to be ignored?

Comment 3

3 years ago
I suspect yes - from a privileged context, the error appears to be reported just fine. That implies that the error is getting masked by the code that handles exposing JS-implemented IDL to unprivileged contexts, which is stuff that very few people have experience digging into. I think the situation should be easier to assess after bug 885982.
You need to log in before you can comment on or make changes to this bug.