GetOfflineFileStream() can fail to return a stream even upon success.
Categories
(MailNews Core :: Backend, defect)
Tracking
(thunderbird_esr68 affected, thunderbird_esr78 wontfix)
People
(Reporter: benc, Assigned: benc)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
In particular, nsMsgDBFolder::GetOfflineFileStream
.
Right at the top, there are some cases where a failure to access the database will result in a return code of NS_OK
but the return value aFileStream
being left untouched.
This seems unintuitive. If I called GetOfflineFileStream() and got NS_OK
as the result code, then I'd expect to have a valid stream too.
Indeed, a lot of uses of GetOfflineFileStream() either check both the result code and the returned stream, or just ignore the code completely.
If NS_OK
and no stream is indeed an acceptable return condition, then at least it should be documented as such in nsIMsgFolder.idl
.
Updated•4 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
Just a note to myself from looking at Bug 1596036:
Seems pretty obvious to me that GetOfflineFileStream() should always return a non-null stream upon success (and failure should always return a fail code). The work is in making sure all the callers of GetOfflineFileStream() conform to that.
OK. Please don't forget the patch in attachment 9204913 [details] [diff] [review] of bug 1596036. There is some clean-up to do.
Assignee | ||
Comment 3•3 years ago
|
||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
So where to you intend to address comment #1 and comment #2?
Updated•3 years ago
|
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/e40d2042c6b7
Make sure nsIMsgFolder.getOfflineFileStream() returns a stream or an error code. r=mkmelin
Assignee | ||
Comment 6•3 years ago
|
||
Just going though the call sites of getOfflineFileStream() and giving them a freshen-up now it's return conditions have been straightened out.
Assignee | ||
Comment 7•3 years ago
|
||
Doh, didn't realise I was using phab on this bug!
Comment 9•3 years ago
|
||
Comment on attachment 9208548 [details] [diff] [review] 1602326-tidy-up-nsIMsgFolder-getOfflineFileStream-callers-1.patch Review of attachment 9208548 [details] [diff] [review]: ----------------------------------------------------------------- LGTM, r=mkmelin
Comment 10•3 years ago
|
||
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/9d888b16cc38 Tidy up error handling for callers of nsIMsgFolder.getOfflineFileStream(). r=mkmelin
Updated•3 years ago
|
Description
•