Bug 50846 - Some FileWriter progress events should be queued
Summary: Some FileWriter progress events should be queued
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Eric U.
Depends on:
Blocks: 44358
  Show dependency treegraph
Reported: 2010-12-10 14:42 PST by Eric U.
Modified: 2011-05-02 17:10 PDT (History)
1 user (show)

See Also:

Patch (6.99 KB, patch)
2011-04-06 13:13 PDT, Eric U.
eric: review+
eric: commit-queue-
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-12-10 14:42:15 PST

When a FileWriter successfully completes a write, currently it:
* dispatches a write event
* sets readyState to DONE
* dispatches a writeend event

If you want to start a new write, you can't do it in onwrite, since readyState is still WRITING. Those events should be queued for asynchronous delivery, so that readyState is DONE by the time they get handled. If you set up a new write in onwrite, you'll still run the risk of getting confused by the subsequent writeend from the previous write, but that's detectable.

I'll have to look and see what other events should be marked as queued.
Comment 1 Eric U. 2011-04-06 13:13:55 PDT
Created attachment 88499 [details]
Comment 2 David Levin 2011-04-25 10:58:22 PDT
Comment on attachment 88499 [details]

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

Not an extensive review as I'm in the middle of something but this should be addressed.

> Source/WebCore/fileapi/FileWriter.h:110
> +        FileWriterCompletionEventTask(PassRefPtr<FileWriter> fileWriter, FileError::ErrorCode code)

Quick comment. This constructor should be private. This should only expose a static create method which returns a PassOwnPtr.
Comment 3 Eric Seidel (no email) 2011-04-26 16:00:06 PDT
Comment on attachment 88499 [details]

This seems fine.
Comment 4 Eric Seidel (no email) 2011-04-26 16:00:29 PDT
Comment on attachment 88499 [details]

Should be fixed per levin's comemnt though.
Comment 5 Eric U. 2011-04-26 16:02:47 PDT
(In reply to comment #4)
> (From update of attachment 88499 [details])
> Should be fixed per levin's comemnt though.

Thanks--I'll fix it before I land it.
Comment 6 Eric U. 2011-05-02 17:10:58 PDT
Committed r85556: <http://trac.webkit.org/changeset/85556>