Bug 37840 - Add FileError for File API
Summary: Add FileError for File API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
URL:
Keywords:
Depends on: 37998
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-19 19:30 PDT by Jian Li
Modified: 2010-04-27 13:49 PDT (History)
2 users (show)

See Also:


Attachments
Proposed Patch (20.68 KB, patch)
2010-04-19 19:32 PDT, Jian Li
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (28.13 KB, patch)
2010-04-20 15:16 PDT, Jian Li
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (17.92 KB, patch)
2010-04-22 11:37 PDT, Jian Li
dimich: 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 2010-04-19 19:30:21 PDT
Need to implement FileError as defined in File API (http://www.w3.org/TR/2009/WD-FileAPI-20091117/#dfn-fileerror).

This is needed by both FileReader and FileWriter.
Comment 1 Jian Li 2010-04-19 19:32:41 PDT
Created attachment 53766 [details]
Proposed Patch
Comment 2 Jian Li 2010-04-20 15:16:41 PDT
Created attachment 53892 [details]
Proposed Patch

Added FileErrorConstructor to DOMWindow.
Comment 3 Dmitry Titov 2010-04-21 16:09:55 PDT
Is it possible to split the patch into modifying the code generators and adding a FileError object?
I'd look at FileError, but there are others with much better understanding of generators...
Comment 4 Jian Li 2010-04-22 11:37:46 PDT
Created attachment 54080 [details]
Proposed Patch

Moved code generator changes to a separate patch.
Comment 5 Dmitry Titov 2010-04-22 11:57:02 PDT
Comment on attachment 54080 [details]
Proposed Patch

r=me with 2 nits:

diff --git a/WebCore/dom/ExceptionCode.h b/WebCore/dom/ExceptionCode.h
+
+        // Introduced in File API:

It'd be nice to have a link to a spec here as well.

+#if ENABLE(FILE_READER) || ENABLE(FILE_WRITER)
+        NOT_READABLE_ERR = 24,
+        ENCODING_ERR = 26,
+#endif

diff --git a/WebCore/html/FileError.h b/WebCore/html/FileError.h
+private:
+    FileError() : m_code(0) { }

Initializer should be on a separate line.
Comment 6 Jian Li 2010-04-23 15:26:17 PDT
Fixed and landed at http://trac.webkit.org/changeset/58194.
Comment 7 Kinuko Yasuda 2010-04-27 11:10:38 PDT
Hi, thanks for adding it.

+class FileError : public RefCounted<FileError> {
+public:
+    static PassRefPtr<FileError> create(ExceptionCode code) { return adoptRef(new FileError(code)); }

+private:
+    FileError() : m_code(0) { }

Don't we need a constructor that takes an ExceptionCode?
Comment 8 Jian Li 2010-04-27 13:49:56 PDT
> Don't we need a constructor that takes an ExceptionCode?

Yes, I noticed this when I turn on the feature during building FileReader. The fix is included in the patch for bug 38157. Thanks.