nsStorageStream publicly implements nsIOutputStream and QIs to it

NEW
Assigned to

Status

()

Core
XPCOM
11 years ago
5 years ago

People

(Reporter: Waldo, Assigned: Waldo)

Tracking

Trunk
mozilla1.9alpha1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

This basically means that the one-and-only-outputstream (and write) checks are useless:

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/xpcom/io/nsStorageStream.cpp&rev=1.32&mark=117,135#110

I think this might be helped by making nsStorageStream inherit from nsIOutputStream privately (I don't know enough about C++ access modifiers in inheritance to say for sure), although that doesn't eliminate QI-ability.  I'm pretty sure more changes are needed here to ensure this works correctly.
What if we just made nsIStorageStream inherit from nsIOutputStream, and removed nsIStorageStream::GetOutputStream?
Oh, we'd have to make nsStorageStream implement nsISeekableStream as well.
I'm a bit far away from this thing at this point, but nsIStorageStream, despite having the name "stream" in it, is not is-a stream.  It provides access to an output that you can write to, and it provides access to input(s, if memory serves) that you can read from.  It definitely shouldn't inherit from nsIOutputStream.
You need to log in before you can comment on or make changes to this bug.