Bug 37840

Summary: Add FileError for File API
Product: WebKit Reporter: Jian Li <jianli>
Component: WebCore JavaScriptAssignee: Jian Li <jianli>
Status: RESOLVED FIXED    
Severity: Normal CC: dimich, kinuko
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 37998    
Bug Blocks:    
Attachments:
Description Flags
Proposed Patch
jianli: commit-queue-
Proposed Patch
jianli: commit-queue-
Proposed Patch dimich: review+, jianli: commit-queue-

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.