- From: Kinuko Yasuda <kinuko@chromium.org>
- Date: Fri, 24 Sep 2010 14:30:23 -0700
- To: Eric Uhrhane <ericu@google.com>
- Cc: Web Applications Working Group WG <public-webapps@w3.org>
On Fri, Sep 24, 2010 at 1:15 PM, Eric Uhrhane <ericu@google.com> wrote: > The abort sequence in FileWriter looks like this: > > "If readyState is DONE, throw a FileException with error code > INVALID_STATE_ERR and terminate this overall series of steps. > Set readyState to DONE. > Terminate any steps having to do with writing a file. > Dispatch a progress event called error. Set the error attribute to a > FileError object with the appropriate code (in this case, ABORT_ERR; > see error conditions). > Dispatch a progress event called abort > Dispatch a progress event called writeend > Stop dispatching any further progress events." > > In this sequence, readyState gets set to DONE before any of the > progress events get sent out. This leaves open a window of > opportunity in which one could start another write/truncate [e.g. in > onError] before the abort and writeend events get dispatched. At that > point you'd get a writeend error that didn't refer to the write in > progress, which is at best nonintuitive. > > I'm planning to move the setting of readyState to just before the > writeEnd event gets dispatched. > That way readyState==DONE always means it's safe to start another > operation, and an abort or writeend event is always unambiguously > tied to a particular write. > > Similarly, in the FileWriter's write and truncate sequences, > readyState gets set to DONE before the error and writeend progress > events are dispatched. I'm going to make the same change there, for > the same reasons, and I'll alter the FileSaver's event sequence to > match. > > Let me know if you see any problem with this. > > Thanks, > > Eric > >
Received on Friday, 24 September 2010 21:31:40 UTC