nsIFileInputStream must return NS_ERROR_NOT_FOUND if Deserialize() fails.

RESOLVED FIXED in Firefox 55

Status

()

Core
DOM
RESOLVED FIXED
2 months ago
a month ago

People

(Reporter: baku, Assigned: baku)

Tracking

(Blocks: 1 bug)

unspecified
mozilla55
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

2 months ago
Currently, if a non-existing file is deserialized, we create a nsIFileInputStream with a null mFD. If we do a Read() on this file, we receive a NS_BASE_STREAM_CLOSED instead of NS_ERROR_FILE_NOT_FOUND.
(Assignee)

Updated

2 months ago
Assignee: nobody → amarchesini
Blocks: 1353629
(Assignee)

Comment 1

2 months ago
Created attachment 8854783 [details] [diff] [review]
ipcBlob_2_fileInputStream.patch
Attachment #8854783 - Flags: review?(ehsan)
(Assignee)

Comment 2

2 months ago
Created attachment 8854806 [details] [diff] [review]
ipcBlob_2_fileInputStream.patch
Attachment #8854783 - Attachment is obsolete: true
Attachment #8854783 - Flags: review?(ehsan)
Attachment #8854806 - Flags: review?(ehsan)
(Assignee)

Comment 3

a month ago
Created attachment 8859929 [details] [diff] [review]
fileInputStream_NOT_FOUND.patch
Attachment #8854806 - Attachment is obsolete: true
Attachment #8854806 - Flags: review?(ehsan)
Attachment #8859929 - Flags: review?(bugs)

Comment 4

a month ago
Comment on attachment 8859929 [details] [diff] [review]
fileInputStream_NOT_FOUND.patch

> nsFileInputStream::Init(nsIFile* aFile, int32_t aIOFlags, int32_t aPerm,
>                         int32_t aBehaviorFlags)
> {
>     NS_ENSURE_TRUE(!mFD, NS_ERROR_ALREADY_INITIALIZED);
>-    NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED);
>+    NS_ENSURE_TRUE(mState == eUnitialized || mState == eClosed,
>+                   NS_ERROR_ALREADY_INITIALIZED);
ok, this changes behavior of the edge case when there was an error, but I guess that is fine.

>+      // Something bad happen in the Open() or in Deserialize(). See
>+      // mErrorValue.
s/happen/happened/
"See mErrorValue" is rather odd comment when mErrorValue isn't document at all.
Perhaps you mean something like "The actual error value is stored in mErrorValue"-
Attachment #8859929 - Flags: review?(bugs) → review+

Comment 5

a month ago
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/daed4710bbf1
nsIFileInputStream must return NS_ERROR_NOT_FOUND if Deserialize() fails, r=smaug
https://hg.mozilla.org/mozilla-central/rev/daed4710bbf1
Status: NEW → RESOLVED
Last Resolved: a month ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.