Closed Bug 1353684 Opened 7 years ago Closed 7 years ago

nsIFileInputStream must return NS_ERROR_NOT_FOUND if Deserialize() fails.

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: baku, Assigned: baku)

References

Details

Attachments

(1 file, 2 obsolete files)

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: nobody → amarchesini
Blocks: 1353629
Attached patch ipcBlob_2_fileInputStream.patch (obsolete) — Splinter Review
Attachment #8854783 - Flags: review?(ehsan)
Attached patch ipcBlob_2_fileInputStream.patch (obsolete) — Splinter Review
Attachment #8854783 - Attachment is obsolete: true
Attachment #8854783 - Flags: review?(ehsan)
Attachment #8854806 - Flags: review?(ehsan)
Attachment #8854806 - Attachment is obsolete: true
Attachment #8854806 - Flags: review?(ehsan)
Attachment #8859929 - Flags: review?(bugs)
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+
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
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: