Bug 47936 - Renumber FileError/FileException error codes per latest File API spec changes
Summary: Renumber FileError/FileException error codes per latest File API spec changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 15:05 PDT by Kinuko Yasuda
Modified: 2010-10-24 22:54 PDT (History)
2 users (show)

See Also:


Attachments
Patch (58.81 KB, patch)
2010-10-20 14:18 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Patch (62.12 KB, patch)
2010-10-20 21:39 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Patch (62.10 KB, patch)
2010-10-22 14:54 PDT, Kinuko Yasuda
jianli: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kinuko Yasuda 2010-10-19 15:05:31 PDT
Renumber FileError/FileException error codes per latest File API spec changes

http://dev.w3.org/2006/webapi/FileAPI/#dfn-FileException
http://dev.w3.org/2009/dap/file-system/file-writer.html#the-fileerror-interface
http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-fileerror-interface

    const unsigned short NOT_FOUND_ERR = 1;
    const unsigned short SECURITY_ERR = 2;
    const unsigned short ABORT_ERR = 3;
    const unsigned short NOT_READABLE_ERR = 4;
    const unsigned short ENCODING_ERR = 5;
    const unsigned short NO_MODIFICATION_ALLOWED_ERR = 6;
    const unsigned short INVALID_STATE_ERR = 7;
    const unsigned short SYNTAX_ERR = 8;
    const unsigned short INVALID_MODIFICATION_ERR = 9;
    const unsigned short QUOTA_EXCEEDED_ERR = 10;
    const unsigned short TYPE_MISMATCH_ERR = 11;
    const unsigned short PATH_EXISTS_ERR = 12;
Comment 1 Kinuko Yasuda 2010-10-20 14:18:51 PDT
Created attachment 71336 [details]
Patch
Comment 2 Jian Li 2010-10-20 18:31:33 PDT
Comment on attachment 71336 [details]
Patch

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

> LayoutTests/ChangeLog:11
> +        * fast/files/read-file-async-expected.txt:

You'd better also update fast/files/workers/read-*-async-expected.txt though worker tests are skipped now.

> WebCore/dom/ExceptionCode.cpp:197
> +    "A requested file or directory could not be found at the time an operation was processed.",

Where did you get the message?

> WebCore/fileapi/FileError.h:43
> +    enum FileErrorCode {

Probably it is simpler to name it as ErrorCode as in PositionError.h or GeolocationError.h.

> WebCore/fileapi/FileException.h:65
> +    static int FileErrorCodeToExceptionCode(int fileErrorCode)

Probably simpler to call it as ErrorCodeToExceptionCode.
Comment 3 Kinuko Yasuda 2010-10-20 21:39:33 PDT
Created attachment 71386 [details]
Patch
Comment 4 Kinuko Yasuda 2010-10-20 21:48:31 PDT
Comment on attachment 71336 [details]
Patch

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

>> LayoutTests/ChangeLog:11
>> +        * fast/files/read-file-async-expected.txt:
> 
> You'd better also update fast/files/workers/read-*-async-expected.txt though worker tests are skipped now.

Done.

>> WebCore/dom/ExceptionCode.cpp:197
>> +    "A requested file or directory could not be found at the time an operation was processed.",
> 
> Where did you get the message?

Basically I copy-pasted those messages from the spec (plus some minor modifications to make them look alike).
For this particular one it's from FileSystem spec, 7.3 Error Code Descriptions.
http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#error-code-descriptions
Please feel free to correct the sentences if they look weird or not relevant.

>> WebCore/fileapi/FileError.h:43
>> +    enum FileErrorCode {
> 
> Probably it is simpler to name it as ErrorCode as in PositionError.h or GeolocationError.h.

Fixed.

>> WebCore/fileapi/FileException.h:65
>> +    static int FileErrorCodeToExceptionCode(int fileErrorCode)
> 
> Probably simpler to call it as ErrorCodeToExceptionCode.

Fixed.
Comment 5 Jian Li 2010-10-21 18:31:26 PDT
Comment on attachment 71386 [details]
Patch

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

> WebCore/dom/ExceptionCode.cpp:204
> +    "An attempt was made to supply an invalid line ending specifier to the API. ",

This description text seems to be too specific.
Comment 6 Kinuko Yasuda 2010-10-21 19:38:49 PDT
(In reply to comment #5)
> (From update of attachment 71386 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=71386&action=review
> 
> > WebCore/dom/ExceptionCode.cpp:204
> > +    "An attempt was made to supply an invalid line ending specifier to the API. ",
> 
> This description text seems to be too specific.

Do you have any alternative suggestions?

It's the only case where useragent should fire SYNTAX_ERR in the entire File API spec and I don't see the strong reason to change it now.
Comment 7 Jian Li 2010-10-22 10:32:13 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > (From update of attachment 71386 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=71386&action=review
> > 
> > > WebCore/dom/ExceptionCode.cpp:204
> > > +    "An attempt was made to supply an invalid line ending specifier to the API. ",
> > 
> > This description text seems to be too specific.
> 
> Do you have any alternative suggestions?
> 
> It's the only case where useragent should fire SYNTAX_ERR in the entire File API spec and I don't see the strong reason to change it now.

Though it is only used in one particular case, I am afraid that it might be used in other cases without updating the original description. How about something like:
  "Invalid or unsupported argument, like invalid line ending specifier."
Comment 8 Kinuko Yasuda 2010-10-22 14:54:07 PDT
Created attachment 71597 [details]
Patch
Comment 9 Kinuko Yasuda 2010-10-22 14:56:16 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > (From update of attachment 71386 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=71386&action=review
> > > 
> > > > WebCore/dom/ExceptionCode.cpp:204
> > > > +    "An attempt was made to supply an invalid line ending specifier to the API. ",
> > > 
> > > This description text seems to be too specific.
> > 
> > Do you have any alternative suggestions?
> > 
> > It's the only case where useragent should fire SYNTAX_ERR in the entire File API spec and I don't see the strong reason to change it now.
> 
> Though it is only used in one particular case, I am afraid that it might be used in other cases without updating the original description. How about something like:
>   "Invalid or unsupported argument, like invalid line ending specifier."

Sounds good, updated the patch.
Comment 10 Kinuko Yasuda 2010-10-24 22:54:38 PDT
Committed r70438: <http://trac.webkit.org/changeset/70438>