Bug 61793 - Update the behavior of multiple reads for FileReader
Summary: Update the behavior of multiple reads for FileReader
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
Depends on:
Reported: 2011-05-31 11:18 PDT by Jian Li
Modified: 2011-06-02 15:27 PDT (History)
4 users (show)

See Also:

Proposed Patch (40.06 KB, patch)
2011-05-31 18:12 PDT, Jian Li
levin: review+
jianli: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2011-05-31 11:18:19 PDT
We need to update the behavior of multiple reads for FileReader per the latest File API spec: http://dev.w3.org/2006/webapi/FileAPI/#MultipleReads

  The FileReader interface makes available four asynchronous read methods -- readAsArrayBuffer, readAsBinaryString, readAsText, and readAsDataURL, which read files into memory. If multiple concurrent read methods are called on the same FileReader object, user agents MUST throw an OperationNotAllowedException with the NOT_ALLOWED_ERR status code on any of the read methods that occur when readyState = LOADING.
Comment 1 Jian Li 2011-05-31 18:12:49 PDT
Created attachment 95523 [details]
Proposed Patch
Comment 2 David Levin 2011-06-01 22:33:01 PDT
Comment on attachment 95523 [details]
Proposed Patch

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

Looks good. Just a few things to consider before checking in.

The one that concerns me the most is the wording for the error message operationNotAllowedExceptionDescriptions.

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:-23070
> -			developmentRegion = English;

Please fix this (and consider upgrading xcode).

> Source/WebCore/bindings/js/JSDOMBinding.cpp:36

fwiw, these ifdef sections should come after all other includes (but I know you are just adding to an existing section).

> Source/WebCore/dom/ExceptionCode.cpp:218
> +    "It was not allowed to call multiple concurrent read methods on the same object when the ready state is LOADING."

How about:
   "A read method was called while another read was in progress."
   "A read method was called while the object was in the LOADING state due to a previous read call."

> Source/WebCore/fileapi/FileReader.cpp:140
> +    m_loader = adoptPtr(new FileReaderLoader(m_readType, this));

The constructor for FileReaderLoader should be private and have a static create method but of course this is just a move of code.

> Source/WebCore/fileapi/FileReader.h:37
> +#include "ExceptionCode.h"

Out of order. (Should be after EventTarget)
Comment 3 Jian Li 2011-06-02 15:27:16 PDT
Committed as https://trac.webkit.org/changeset/87961.