Bug 47139 - Relax restrictions on FileWriter::didWrite calls
: Relax restrictions on FileWriter::didWrite calls
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: HTML DOM
: 528+ (Nightly build)
: All All
: P2 Enhancement
Assigned To: Eric U.
:
Depends on:
Blocks: 44358
  Show dependency treegraph
 
Reported: 2010-10-04 19:20 PDT by Eric U.
Modified: 2010-10-05 13:29 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.63 KB, patch)
2010-10-04 19:31 PDT, Eric U.
no flags Details | Formatted Diff | Diff
Patch (2.63 KB, patch)
2010-10-05 10:42 PDT, Eric U.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric U. 2010-10-04 19:20:29 PDT
Currently we ASSERT that we'll always receive bytes in a didWrite call, and that we'll always get complete==true if we've gotten all the bytes in our request.  This unnecessarily constrains the implementation: if the backend is just reading from the blob until it runs out, it might send the last bytes without knowing that it's done, then send a zero-length completion message.
Comment 1 Eric U. 2010-10-04 19:31:24 PDT
Created attachment 69731 [details]
Patch
Comment 2 Kinuko Yasuda 2010-10-04 20:04:05 PDT
Comment on attachment 69731 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=69731&action=review

> WebCore/fileapi/FileWriter.cpp:97
> +        ec = INVALID_ACCESS_ERR;

INVALID_ACCESS_ERR is not defined as a FileError -- maybe INVALID_STATE_ERR?
Comment 3 Eric U. 2010-10-04 20:14:57 PDT
(In reply to comment #2)
> (From update of attachment 69731 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=69731&action=review
> 
> > WebCore/fileapi/FileWriter.cpp:97
> > +        ec = INVALID_ACCESS_ERR;
> 
> INVALID_ACCESS_ERR is not defined as a FileError -- maybe INVALID_STATE_ERR?

It's not really an invalid state; you passed in a bad parameter.  Perhaps SYNTAX_ERR?  We can always suggest that it go into the spec [which currently doesn't talk about how to respond to a null Blob].
Comment 4 Kinuko Yasuda 2010-10-04 20:35:57 PDT
Comment on attachment 69731 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=69731&action=review

>>> WebCore/fileapi/FileWriter.cpp:97
>>> +        ec = INVALID_ACCESS_ERR;
>> 
>> INVALID_ACCESS_ERR is not defined as a FileError -- maybe INVALID_STATE_ERR?
> 
> It's not really an invalid state; you passed in a bad parameter.  Perhaps SYNTAX_ERR?  We can always suggest that it go into the spec [which currently doesn't talk about how to respond to a null Blob].

If we're given null or undefined where we expect Blob, I think TYPE_MISMATCH_ERR would be applicable.
Comment 5 Eric U. 2010-10-04 20:52:39 PDT
(In reply to comment #4)
> (From update of attachment 69731 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=69731&action=review
> 
> >>> WebCore/fileapi/FileWriter.cpp:97
> >>> +        ec = INVALID_ACCESS_ERR;
> >> 
> >> INVALID_ACCESS_ERR is not defined as a FileError -- maybe INVALID_STATE_ERR?
> > 
> > It's not really an invalid state; you passed in a bad parameter.  Perhaps SYNTAX_ERR?  We can always suggest that it go into the spec [which currently doesn't talk about how to respond to a null Blob].
> 
> If we're given null or undefined where we expect Blob, I think TYPE_MISMATCH_ERR would be applicable.

Yeah, that sounds good.  I'll change it.
Comment 6 David Levin 2010-10-04 23:56:44 PDT
Comment on attachment 69731 [details]
Patch

Per discussion in bug. Other than that it seems fine.
Comment 7 Eric U. 2010-10-05 10:42:03 PDT
Created attachment 69807 [details]
Patch
Comment 8 WebKit Commit Bot 2010-10-05 13:29:09 PDT
Comment on attachment 69807 [details]
Patch

Clearing flags on attachment: 69807

Committed r69140: <http://trac.webkit.org/changeset/69140>
Comment 9 WebKit Commit Bot 2010-10-05 13:29:14 PDT
All reviewed patches have been landed.  Closing bug.