As http://lxr.mozilla.org/mozilla/source/xpcom/io/nsIBinaryInputStream.idl#37 shows, nsIBinaryInputStream inherits from nsIInputStream but attempting to QI it gives this: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface]" nsresult: "0x80004002 (NS_NOINTERFACE)" location: "JS frame :: chrome://chatzilla/content/commands.js :: anonymous :: line 1402" data: no
Created attachment 143994 [details] [diff] [review] Adds nsIInputStream to the ISUPPORT list. This allows the desired QI when tested here.
hm... from nsBinaryStreams.h: // Derive from nsIObjectInputStream so this class can be used as a superclass // by nsObjectInputStream. class nsBinaryInputStream : public nsIObjectInputStream so should this also support nsIObjectInputStream in QueryInterface?
Created attachment 144017 [details] [diff] [review] revised patch
Attachment #143994 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.7beta
15 years ago
Attachment #144017 - Flags: review?(cbiesinger) → review+
Comment on attachment 144017 [details] [diff] [review] revised patch I'm not sure we want nsBinaryInputStream QI'ing to nsIObjectInputStream, nor should nsBinaryOutputStream QI to nsIObjectOutputStream, because the object-stream stubs call NS_NOTREACHED and return NS_ERROR_NOT_IMPLEMENTED. It's true that the concrete class implements the interface. If we do this, then all is well in nsFastLoadFile.cpp. If we don't include the nsIObject*Stream interface in the corresponding NS_IMPL_ISUPPORTS calls in nsBinaryStream.cpp, then I guess nsFastLoadFile.cpp needs to list 'em. Thoughts? /be
hmm... nsFastLoadFile.cpp does list nsIObject*Stream in its ISUPPORTS_INHERITED macros. so that's all fine-n-dandy. however, i still think nsBinary*Stream should list nsIObject*Stream in its QI list. my reasoning is this: suppose in some other component I want to create a class that is a wrapper for a nsBinaryInputStream. suppose I want to access nsIObjectInputStream::GetBuffer/PutBuffer. i'd need QI to work. perhaps it should just be documented in nsBinary*Stream's contract that it does not implement all of nsIObject*Stream.
or we could say that nsBinary*Stream inheriting from nsIObject*Stream is an implementation detail of nsFastLoadFile.
Comment on attachment 144017 [details] [diff] [review] revised patch Sold. Safe for 1.7 too, I'm approving as well as sr='ing. /be
fixed-on-trunk for 1.7 final
Status: ASSIGNED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
V/via cvs: 1.22darin%meer.net2004-04-03 09:09 fixes bug 237590 "nsIBinaryInputStream inherits from nsIInputStream but can't be QI'ed to it" r=biesi sr=brendan a=brendan
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.