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

NEW
Unassigned

Status

()

Core
XPCOM
P5
enhancement
12 years ago
5 years ago

People

(Reporter: timeless, Unassigned)

Tracking

({helpwanted})

Trunk
x86
Windows XP
helpwanted
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

12 years ago
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.

Comment 3

10 years ago
mass reassigning to nobody.
Assignee: dougt → nobody

Updated

5 years ago
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.