Open Bug 1057538 Opened 10 years ago Updated 2 years ago

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

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
macOS
defect

Tracking

()

People

(Reporter: marco, Unassigned)

Details

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.
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?
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.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.