Open Bug 310410 Opened 19 years ago Updated 2 years ago

please change "@mozilla.org/binaryinputstream;1"nsIBinaryInputStream.readBytes to return a more meaningful error than NS_ERROR_FAILURE

Categories

(Core :: XPCOM, enhancement, P5)

x86
Windows XP
enhancement

Tracking

()

People

(Reporter: timeless, Unassigned)

References

()

Details

(Keywords: helpwanted)

we had code that called socket.nsIBinaryInputStream.readBytes(1), it would 
occasionally trigger: NS_ERROR_FAILURE

i just added code to call socket.nsIBinaryInputStream.available() first and it 
seems that the only time we'd get NS_ERROR_FAILURE from readBytes is when 
available() would return NS_BASE_STREAM_CLOSED.

double exception: [Exception... "Component returned failure code: 0x80470002 
(NS_BASE_STREAM_CLOSED) [nsIBinaryInputStream.available]"  
nsresult: "0x80470002 (NS_BASE_STREAM_CLOSED)"  location: "JS frame :: 
test.js :: my_function :: line 1100"  data: no] <-> [Exception... "Component 
returned failure code: 0x80004005 (NS_ERROR_FAILURE) 
[nsIBinaryInputStream.readBytes]"  nsresult: "0x8
--nspr logging truncated.
So the code in question is:

641     if (bytesRead != aLength) {
642         nsMemory::Free(s);
643         return NS_ERROR_FAILURE;
644     }

in nsBinaryStream.cpp.

That seems a little odd to me, frankly...
Keywords: helpwanted
that's one part of the reason for bug 329448.
mass reassigning to nobody.
Assignee: dougt → nobody
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.