nsIBinaryInputStream inherits from nsIInputStream but can't be QI'ed to it

VERIFIED FIXED in mozilla1.7final

Status

()

VERIFIED FIXED
15 years ago
15 years ago

People

(Reporter: bugzilla-mozilla-20000923, Assigned: darin.moz)

Tracking

Trunk
mozilla1.7final
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

15 years ago
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
(Reporter)

Comment 1

15 years ago
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?
(Assignee)

Comment 3

15 years ago
Created attachment 144017 [details] [diff] [review]
revised patch
Attachment #143994 - Attachment is obsolete: true
(Assignee)

Updated

15 years ago
Attachment #144017 - Flags: review?(cbiesinger)
(Assignee)

Updated

15 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.7beta
Attachment #144017 - Flags: review?(cbiesinger) → review+
(Assignee)

Updated

15 years ago
Attachment #144017 - Flags: superreview?(brendan)
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
(Assignee)

Comment 5

15 years ago
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.
(Assignee)

Comment 6

15 years ago
or we could say that nsBinary*Stream inheriting from nsIObject*Stream is an
implementation detail of nsFastLoadFile.
(Assignee)

Updated

15 years ago
Target Milestone: mozilla1.7beta → mozilla1.7final
Comment on attachment 144017 [details] [diff] [review]
revised patch

Sold.  Safe for 1.7 too, I'm approving as well as sr='ing.

/be
Attachment #144017 - Flags: superreview?(brendan)
Attachment #144017 - Flags: superreview+
Attachment #144017 - Flags: approval1.7+
(Assignee)

Comment 8

15 years ago
fixed-on-trunk for 1.7 final
Status: ASSIGNED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED

Comment 9

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