Changeset 70438 in webkit


Ignore:
Timestamp:
Oct 24, 2010 10:53:35 PM (13 years ago)
Author:
kinuko@chromium.org
Message:

2010-10-20 Kinuko Yasuda <kinuko@chromium.org>

Reviewed by Jian Li.

Renumber FileError/FileException error codes per latest File API spec changes
https://bugs.webkit.org/show_bug.cgi?id=47936

  • public/WebFileError.h:
  • src/AssertMatchingEnums.cpp:
  • src/AsyncFileWriterChromium.cpp: (WebCore::AsyncFileWriterChromium::didFail):

2010-10-20 Kinuko Yasuda <kinuko@chromium.org>

Reviewed by Jian Li.

Renumber FileError/FileException error codes per latest File API spec changes
https://bugs.webkit.org/show_bug.cgi?id=47936

  • bindings/js/JSDOMBinding.cpp: (WebCore::setDOMException): Added FileExceptionType case.
  • bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::setDOMException): Added FileExceptionType case.
  • dom/ExceptionCode.cpp: (WebCore::getExceptionCodeDescription): Added code for FileException.
  • dom/ExceptionCode.h:
  • fileapi/AsyncFileWriterClient.h:
  • fileapi/DirectoryEntry.cpp: (WebCore::DirectoryEntry::getFile): (WebCore::DirectoryEntry::getDirectory): (WebCore::DirectoryEntry::removeRecursively):
  • fileapi/DirectoryEntrySync.cpp: (WebCore::DirectoryEntrySync::getFile): (WebCore::DirectoryEntrySync::getDirectory): (WebCore::DirectoryEntrySync::removeRecursively):
  • fileapi/DirectoryReaderSync.cpp: (WebCore::DirectoryReaderSync::readEntries):
  • fileapi/Entry.cpp: (WebCore::Entry::getMetadata): (WebCore::Entry::moveTo): (WebCore::Entry::copyTo): (WebCore::Entry::remove): (WebCore::Entry::getParent):
  • fileapi/EntrySync.cpp: (WebCore::EntrySync::getMetadata): (WebCore::EntrySync::moveTo): (WebCore::EntrySync::copyTo): (WebCore::EntrySync::remove):
  • fileapi/FileError.h: Added error code enum. (WebCore::FileError::create): (WebCore::FileError::code): (WebCore::FileError::FileError):
  • fileapi/FileError.idl: Rebased error code numbers.
  • fileapi/FileException.h: Added exception code enum. (WebCore::FileException::ErrorCodeToExceptionCode): Added.
  • fileapi/FileException.idl: Rebased exception code numbers.
  • fileapi/FileReader.cpp: (WebCore::FileReader::abort): (WebCore::FileReader::failed): (WebCore::FileReader::httpStatusCodeToErrorCode): Changed from httpStatuCodeToExceptionCode.
  • fileapi/FileReader.h:
  • fileapi/FileReaderSync.cpp: (WebCore::FileReaderSyncLoader::start):
  • fileapi/FileSystemCallbacks.cpp: (WebCore::FileSystemCallbacksBase::didFail):
  • fileapi/FileWriter.cpp: (WebCore::FileWriter::write): (WebCore::FileWriter::seek): (WebCore::FileWriter::truncate): (WebCore::FileWriter::abort): (WebCore::FileWriter::didFail): (WebCore::FileWriter::setError):
  • fileapi/FileWriter.h:
  • fileapi/SyncCallbackHelper.h: (WebCore::SyncCallbackHelper::SyncCallbackHelper): (WebCore::SyncCallbackHelper::getResult): (WebCore::SyncCallbackHelper::setError):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::requestFileSystem):
  • workers/WorkerContext.cpp: (WebCore::WorkerContext::requestFileSystem): (WebCore::WorkerContext::requestFileSystemSync):

2010-10-20 Kinuko Yasuda <kinuko@chromium.org>

Reviewed by Jian Li.

Renumber FileError/FileException error codes per latest File API spec changes
https://bugs.webkit.org/show_bug.cgi?id=47936

Updated test expectations to match with the new error code.

  • fast/files/read-blob-async-expected.txt:
  • fast/files/read-file-async-expected.txt:
  • fast/files/workers/worker-read-blob-async-expected.txt:
  • fast/files/workers/worker-read-blob-sync-expected.txt:
  • fast/files/workers/worker-read-file-async-expected.txt:
  • fast/files/workers/worker-read-file-sync-expected.txt:
  • fast/filesystem/op-copy-expected.txt:
  • fast/filesystem/op-get-entry-expected.txt:
  • fast/filesystem/op-move-expected.txt:
  • fast/filesystem/op-remove-expected.txt:
  • fast/filesystem/op-restricted-chars-expected.txt:
  • fast/filesystem/op-restricted-names-expected.txt:
Location:
trunk
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70432 r70438  
     12010-10-20  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Reviewed by Jian Li.
     4
     5        Renumber FileError/FileException error codes per latest File API spec changes
     6        https://bugs.webkit.org/show_bug.cgi?id=47936
     7
     8        Updated test expectations to match with the new error code.
     9
     10        * fast/files/read-blob-async-expected.txt:
     11        * fast/files/read-file-async-expected.txt:
     12        * fast/files/workers/worker-read-blob-async-expected.txt:
     13        * fast/files/workers/worker-read-blob-sync-expected.txt:
     14        * fast/files/workers/worker-read-file-async-expected.txt:
     15        * fast/files/workers/worker-read-file-sync-expected.txt:
     16        * fast/filesystem/op-copy-expected.txt:
     17        * fast/filesystem/op-get-entry-expected.txt:
     18        * fast/filesystem/op-move-expected.txt:
     19        * fast/filesystem/op-remove-expected.txt:
     20        * fast/filesystem/op-restricted-chars-expected.txt:
     21        * fast/filesystem/op-restricted-names-expected.txt:
     22
    1232010-10-24  MORITA Hajime  <morrita@google.com>
    224
  • trunk/LayoutTests/fast/files/read-blob-async-expected.txt

    r69883 r70438  
    44Received error event
    55readyState: 2
    6 error code: 8
     6error code: 1
    77Received loadend event
    88Test reading a blob containing existent and non-existent file
     
    1010Received error event
    1111readyState: 2
    12 error code: 8
     12error code: 1
    1313Received loadend event
    1414Test reading a blob containing empty file
  • trunk/LayoutTests/fast/files/read-file-async-expected.txt

    r66452 r70438  
    44Received error event
    55readyState: 2
    6 error code: 8
     6error code: 1
    77Received loadend event
    88Test reading a non-existent file as text
     
    1010Received error event
    1111readyState: 2
    12 error code: 8
     12error code: 1
    1313Received loadend event
    1414Test reading a non-existent file as data URL
     
    1616Received error event
    1717readyState: 2
    18 error code: 8
     18error code: 1
    1919Received loadend event
    2020Test reading an empty file as binary string
  • trunk/LayoutTests/fast/files/workers/worker-read-blob-async-expected.txt

    r69883 r70438  
    55Received error event
    66readyState: 2
    7 error code: 8
     7error code: 1
    88Received loadend event
    99Test reading a blob containing existent and non-existent file
     
    1111Received error event
    1212readyState: 2
    13 error code: 8
     13error code: 1
    1414Received loadend event
    1515Test reading a blob containing empty file
  • trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt

    r69883 r70438  
    22Received files in worker
    33Test reading a blob containing non-existent file
    4 Received exception 8: NOT_FOUND_ERR
     4Received exception 1: NOT_FOUND_ERR
    55Test reading a blob containing existent and non-existent file
    6 Received exception 8: NOT_FOUND_ERR
     6Received exception 1: NOT_FOUND_ERR
    77Test reading a blob containing empty file
    88
     
    1818data:base64,Rmlyc3Q=
    1919Test reading a blob containing single text as data URL (optional content type provided)
    20 result: data:type/foo;base64,Rmlyc3Q=
     20data:type/foo;base64,Rmlyc3Q=
    2121Test reading a blob containing sliced file
    2222onder
  • trunk/LayoutTests/fast/files/workers/worker-read-file-async-expected.txt

    r66461 r70438  
    55Received error event
    66readyState: 2
    7 error code: 8
     7error code: 1
    88Received loadend event
    99Test reading a non-existent file as text
     
    1111Received error event
    1212readyState: 2
    13 error code: 8
     13error code: 1
    1414Received loadend event
    1515Test reading a non-existent file as data URL
     
    1717Received error event
    1818readyState: 2
    19 error code: 8
     19error code: 1
    2020Received loadend event
    2121Test reading an empty file as binary string
  • trunk/LayoutTests/fast/filesystem/op-copy-expected.txt

    r69339 r70438  
    2020PASS Verified entry: ENTRY {path:/c/b name:b type:FILE}
    2121* Running: CopyFileWithEmptyNameToSameDirectory
    22 PASS this.expectedErrorCode + "" is "13"
     22PASS this.expectedErrorCode + "" is "9"
    2323PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    2424PASS Verified entry: ENTRY {path:/a/b name:b type:FILE}
    2525* Running: CopyFileWithSameName
    26 PASS this.expectedErrorCode + "" is "13"
     26PASS this.expectedErrorCode + "" is "9"
    2727PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    2828PASS Verified entry: ENTRY {path:/a/b name:b type:FILE}
    2929* Running: CopyForNonExistentEntry
    3030PASS Succeeded: "/a/b".remove()
    31 PASS this.expectedErrorCode + "" is "8"
     31PASS this.expectedErrorCode + "" is "1"
    3232PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    3333PASS Verified entry: ENTRY {path:/c name:c type:DIRECTORY}
    3434* Running: CopyEntryToNonExistentDirectory
    3535PASS Succeeded: "/c".remove()
    36 PASS this.expectedErrorCode + "" is "8"
     36PASS this.expectedErrorCode + "" is "1"
    3737PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    3838PASS Verified entry: ENTRY {path:/a/b name:b type:FILE}
    3939* Running: CopyEntryToItsChild
    40 PASS this.expectedErrorCode + "" is "13"
    41 PASS this.expectedErrorCode + "" is "13"
     40PASS this.expectedErrorCode + "" is "9"
     41PASS this.expectedErrorCode + "" is "9"
    4242PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    4343PASS Verified entry: ENTRY {path:/a/b name:b type:DIRECTORY}
  • trunk/LayoutTests/fast/filesystem/op-get-entry-expected.txt

    r69382 r70438  
    2525PASS Succeeded: "/a".getDirectory("/a/../../d")
    2626PASS Succeeded: "/a".getDirectory("/a/../../b/./c/../../../../../e")
    27 PASS this.expectedErrorCode + "" is "13"
    28 PASS this.expectedErrorCode + "" is "13"
     27PASS this.expectedErrorCode + "" is "9"
     28PASS this.expectedErrorCode + "" is "9"
    2929PASS Succeeded: "/a".getFile("./b.txt")
    3030PASS Succeeded: "/a".getFile("../b.txt")
     
    3232PASS Succeeded: "/a".getFile("/a/../../d.txt")
    3333PASS Succeeded: "/a".getFile("/a/../../b/./c/../../../../../e.txt")
    34 PASS this.expectedErrorCode + "" is "13"
    35 PASS this.expectedErrorCode + "" is "13"
     34PASS this.expectedErrorCode + "" is "9"
     35PASS this.expectedErrorCode + "" is "9"
    3636PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    3737PASS Verified entry: ENTRY {path:/a/b name:b type:DIRECTORY}
     
    6767PASS Verified entry: ENTRY {path:/b name:b type:FILE}
    6868* Running: GetNonExistent
    69 PASS this.expectedErrorCode + "" is "8"
    70 PASS this.expectedErrorCode + "" is "8"
    71 PASS this.expectedErrorCode + "" is "8"
    72 PASS this.expectedErrorCode + "" is "8"
     69PASS this.expectedErrorCode + "" is "1"
     70PASS this.expectedErrorCode + "" is "1"
     71PASS this.expectedErrorCode + "" is "1"
     72PASS this.expectedErrorCode + "" is "1"
    7373* Running: GetFileForDirectory
    74 PASS this.expectedErrorCode + "" is "11"
    75 PASS this.expectedErrorCode + "" is "11"
     74PASS this.expectedErrorCode + "" is "7"
     75PASS this.expectedErrorCode + "" is "7"
    7676PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    7777* Running: GetDirectoryForFile
    78 PASS this.expectedErrorCode + "" is "11"
    79 PASS this.expectedErrorCode + "" is "11"
     78PASS this.expectedErrorCode + "" is "7"
     79PASS this.expectedErrorCode + "" is "7"
    8080PASS Verified entry: ENTRY {path:/a name:a type:FILE}
    8181* Running: CreateWithExclusive
    82 PASS this.expectedErrorCode + "" is "13"
    83 PASS this.expectedErrorCode + "" is "13"
     82PASS this.expectedErrorCode + "" is "9"
     83PASS this.expectedErrorCode + "" is "9"
    8484PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    8585PASS Verified entry: ENTRY {path:/b name:b type:FILE}
  • trunk/LayoutTests/fast/filesystem/op-move-expected.txt

    r69339 r70438  
    2020PASS Verified entry: ENTRY {path:/c/b name:b type:FILE}
    2121* Running: MoveFileWithEmptyNameToSameDirectory
    22 PASS this.expectedErrorCode + "" is "13"
     22PASS this.expectedErrorCode + "" is "9"
    2323PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    2424PASS Verified entry: ENTRY {path:/a/b name:b type:FILE}
    2525* Running: MoveFileWithSameName
    26 PASS this.expectedErrorCode + "" is "13"
     26PASS this.expectedErrorCode + "" is "9"
    2727PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    2828PASS Verified entry: ENTRY {path:/a/b name:b type:FILE}
    2929* Running: MoveForNonExistentEntry
    3030PASS Succeeded: "/a/b".remove()
    31 PASS this.expectedErrorCode + "" is "8"
     31PASS this.expectedErrorCode + "" is "1"
    3232PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    3333PASS Verified entry: ENTRY {path:/c name:c type:DIRECTORY}
    3434* Running: MoveEntryToNonExistentDirectory
    3535PASS Succeeded: "/c".remove()
    36 PASS this.expectedErrorCode + "" is "8"
     36PASS this.expectedErrorCode + "" is "1"
    3737PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    3838PASS Verified entry: ENTRY {path:/a/b name:b type:FILE}
    3939* Running: MoveEntryToItsChild
    40 PASS this.expectedErrorCode + "" is "13"
    41 PASS this.expectedErrorCode + "" is "13"
     40PASS this.expectedErrorCode + "" is "9"
     41PASS this.expectedErrorCode + "" is "9"
    4242PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    4343PASS Verified entry: ENTRY {path:/a/b name:b type:DIRECTORY}
  • trunk/LayoutTests/fast/filesystem/op-remove-expected.txt

    r69485 r70438  
    22PASS Succeeded: "/a".remove()
    33PASS Succeeded: "/b".remove()
    4 PASS this.expectedErrorCode + "" is "13"
     4PASS this.expectedErrorCode + "" is "9"
    55PASS Verified entry does NOT exist: /a
    66PASS Verified entry does NOT exist: /b
    77* Running: RemoveNonRecursiveWithChildren
    8 PASS this.expectedErrorCode + "" is "13"
     8PASS this.expectedErrorCode + "" is "9"
    99PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    1010PASS Verified entry: ENTRY {path:/a/b name:b type:DIRECTORY}
     
    1515* Running: RemoveRecursiveWithChildren
    1616PASS Succeeded: "/a".removeRecursively()
    17 PASS this.expectedErrorCode + "" is "13"
     17PASS this.expectedErrorCode + "" is "9"
    1818PASS Verified entry does NOT exist: /a
    1919Finished running tests.
  • trunk/LayoutTests/fast/filesystem/op-restricted-chars-expected.txt

    r69339 r70438  
    11* Running: RestrictedChars
    2 PASS this.expectedErrorCode + "" is "13"
    3 PASS this.expectedErrorCode + "" is "13"
    4 PASS this.expectedErrorCode + "" is "13"
    5 PASS this.expectedErrorCode + "" is "13"
    6 PASS this.expectedErrorCode + "" is "13"
    7 PASS this.expectedErrorCode + "" is "13"
    8 PASS this.expectedErrorCode + "" is "13"
    9 PASS this.expectedErrorCode + "" is "13"
    10 PASS this.expectedErrorCode + "" is "13"
    11 PASS this.expectedErrorCode + "" is "13"
    12 PASS this.expectedErrorCode + "" is "13"
    13 PASS this.expectedErrorCode + "" is "13"
    14 PASS this.expectedErrorCode + "" is "13"
    15 PASS this.expectedErrorCode + "" is "13"
    16 PASS this.expectedErrorCode + "" is "13"
    17 PASS this.expectedErrorCode + "" is "13"
    18 PASS this.expectedErrorCode + "" is "13"
    19 PASS this.expectedErrorCode + "" is "13"
    20 PASS this.expectedErrorCode + "" is "13"
    21 PASS this.expectedErrorCode + "" is "13"
    22 PASS this.expectedErrorCode + "" is "13"
    23 PASS this.expectedErrorCode + "" is "13"
     2PASS this.expectedErrorCode + "" is "9"
     3PASS this.expectedErrorCode + "" is "9"
     4PASS this.expectedErrorCode + "" is "9"
     5PASS this.expectedErrorCode + "" is "9"
     6PASS this.expectedErrorCode + "" is "9"
     7PASS this.expectedErrorCode + "" is "9"
     8PASS this.expectedErrorCode + "" is "9"
     9PASS this.expectedErrorCode + "" is "9"
     10PASS this.expectedErrorCode + "" is "9"
     11PASS this.expectedErrorCode + "" is "9"
     12PASS this.expectedErrorCode + "" is "9"
     13PASS this.expectedErrorCode + "" is "9"
     14PASS this.expectedErrorCode + "" is "9"
     15PASS this.expectedErrorCode + "" is "9"
     16PASS this.expectedErrorCode + "" is "9"
     17PASS this.expectedErrorCode + "" is "9"
     18PASS this.expectedErrorCode + "" is "9"
     19PASS this.expectedErrorCode + "" is "9"
     20PASS this.expectedErrorCode + "" is "9"
     21PASS this.expectedErrorCode + "" is "9"
     22PASS this.expectedErrorCode + "" is "9"
     23PASS this.expectedErrorCode + "" is "9"
    2424PASS Succeeded: "/".getFile("ab")
    25 PASS this.expectedErrorCode + "" is "13"
    26 PASS this.expectedErrorCode + "" is "13"
    27 PASS this.expectedErrorCode + "" is "13"
    28 PASS this.expectedErrorCode + "" is "13"
    29 PASS this.expectedErrorCode + "" is "13"
    30 PASS this.expectedErrorCode + "" is "13"
    31 PASS this.expectedErrorCode + "" is "13"
    32 PASS this.expectedErrorCode + "" is "13"
     25PASS this.expectedErrorCode + "" is "9"
     26PASS this.expectedErrorCode + "" is "9"
     27PASS this.expectedErrorCode + "" is "9"
     28PASS this.expectedErrorCode + "" is "9"
     29PASS this.expectedErrorCode + "" is "9"
     30PASS this.expectedErrorCode + "" is "9"
     31PASS this.expectedErrorCode + "" is "9"
     32PASS this.expectedErrorCode + "" is "9"
    3333PASS Verified entry: ENTRY {path:/ab name:ab type:FILE}
    3434Finished running tests.
  • trunk/LayoutTests/fast/filesystem/op-restricted-names-expected.txt

    r69339 r70438  
    11* Running: RestrictedChars
    2 PASS this.expectedErrorCode + "" is "13"
    3 PASS this.expectedErrorCode + "" is "13"
    4 PASS this.expectedErrorCode + "" is "13"
    5 PASS this.expectedErrorCode + "" is "13"
    6 PASS this.expectedErrorCode + "" is "13"
    7 PASS this.expectedErrorCode + "" is "13"
    8 PASS this.expectedErrorCode + "" is "13"
    9 PASS this.expectedErrorCode + "" is "13"
    10 PASS this.expectedErrorCode + "" is "13"
    11 PASS this.expectedErrorCode + "" is "13"
    12 PASS this.expectedErrorCode + "" is "13"
    13 PASS this.expectedErrorCode + "" is "13"
    14 PASS this.expectedErrorCode + "" is "13"
    15 PASS this.expectedErrorCode + "" is "13"
    16 PASS this.expectedErrorCode + "" is "13"
    17 PASS this.expectedErrorCode + "" is "13"
    18 PASS this.expectedErrorCode + "" is "13"
    19 PASS this.expectedErrorCode + "" is "13"
    20 PASS this.expectedErrorCode + "" is "13"
    21 PASS this.expectedErrorCode + "" is "13"
    22 PASS this.expectedErrorCode + "" is "13"
    23 PASS this.expectedErrorCode + "" is "13"
    24 PASS this.expectedErrorCode + "" is "13"
    25 PASS this.expectedErrorCode + "" is "13"
    26 PASS this.expectedErrorCode + "" is "13"
    27 PASS this.expectedErrorCode + "" is "13"
    28 PASS this.expectedErrorCode + "" is "13"
    29 PASS this.expectedErrorCode + "" is "13"
    30 PASS this.expectedErrorCode + "" is "13"
    31 PASS this.expectedErrorCode + "" is "13"
    32 PASS this.expectedErrorCode + "" is "13"
    33 PASS this.expectedErrorCode + "" is "13"
    34 PASS this.expectedErrorCode + "" is "13"
    35 PASS this.expectedErrorCode + "" is "13"
    36 PASS this.expectedErrorCode + "" is "13"
    37 PASS this.expectedErrorCode + "" is "13"
    38 PASS this.expectedErrorCode + "" is "13"
    39 PASS this.expectedErrorCode + "" is "13"
    40 PASS this.expectedErrorCode + "" is "13"
     2PASS this.expectedErrorCode + "" is "9"
     3PASS this.expectedErrorCode + "" is "9"
     4PASS this.expectedErrorCode + "" is "9"
     5PASS this.expectedErrorCode + "" is "9"
     6PASS this.expectedErrorCode + "" is "9"
     7PASS this.expectedErrorCode + "" is "9"
     8PASS this.expectedErrorCode + "" is "9"
     9PASS this.expectedErrorCode + "" is "9"
     10PASS this.expectedErrorCode + "" is "9"
     11PASS this.expectedErrorCode + "" is "9"
     12PASS this.expectedErrorCode + "" is "9"
     13PASS this.expectedErrorCode + "" is "9"
     14PASS this.expectedErrorCode + "" is "9"
     15PASS this.expectedErrorCode + "" is "9"
     16PASS this.expectedErrorCode + "" is "9"
     17PASS this.expectedErrorCode + "" is "9"
     18PASS this.expectedErrorCode + "" is "9"
     19PASS this.expectedErrorCode + "" is "9"
     20PASS this.expectedErrorCode + "" is "9"
     21PASS this.expectedErrorCode + "" is "9"
     22PASS this.expectedErrorCode + "" is "9"
     23PASS this.expectedErrorCode + "" is "9"
     24PASS this.expectedErrorCode + "" is "9"
     25PASS this.expectedErrorCode + "" is "9"
     26PASS this.expectedErrorCode + "" is "9"
     27PASS this.expectedErrorCode + "" is "9"
     28PASS this.expectedErrorCode + "" is "9"
     29PASS this.expectedErrorCode + "" is "9"
     30PASS this.expectedErrorCode + "" is "9"
     31PASS this.expectedErrorCode + "" is "9"
     32PASS this.expectedErrorCode + "" is "9"
     33PASS this.expectedErrorCode + "" is "9"
     34PASS this.expectedErrorCode + "" is "9"
     35PASS this.expectedErrorCode + "" is "9"
     36PASS this.expectedErrorCode + "" is "9"
     37PASS this.expectedErrorCode + "" is "9"
     38PASS this.expectedErrorCode + "" is "9"
     39PASS this.expectedErrorCode + "" is "9"
     40PASS this.expectedErrorCode + "" is "9"
    4141PASS Verified entry: ENTRY {path:/a name:a type:DIRECTORY}
    4242Finished running tests.
  • trunk/WebCore/ChangeLog

    r70435 r70438  
     12010-10-20  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Reviewed by Jian Li.
     4
     5        Renumber FileError/FileException error codes per latest File API spec changes
     6        https://bugs.webkit.org/show_bug.cgi?id=47936
     7
     8        * bindings/js/JSDOMBinding.cpp:
     9        (WebCore::setDOMException): Added FileExceptionType case.
     10        * bindings/v8/V8Proxy.cpp:
     11        (WebCore::V8Proxy::setDOMException): Added FileExceptionType case.
     12        * dom/ExceptionCode.cpp:
     13        (WebCore::getExceptionCodeDescription): Added code for FileException.
     14        * dom/ExceptionCode.h:
     15        * fileapi/AsyncFileWriterClient.h:
     16        * fileapi/DirectoryEntry.cpp:
     17        (WebCore::DirectoryEntry::getFile):
     18        (WebCore::DirectoryEntry::getDirectory):
     19        (WebCore::DirectoryEntry::removeRecursively):
     20        * fileapi/DirectoryEntrySync.cpp:
     21        (WebCore::DirectoryEntrySync::getFile):
     22        (WebCore::DirectoryEntrySync::getDirectory):
     23        (WebCore::DirectoryEntrySync::removeRecursively):
     24        * fileapi/DirectoryReaderSync.cpp:
     25        (WebCore::DirectoryReaderSync::readEntries):
     26        * fileapi/Entry.cpp:
     27        (WebCore::Entry::getMetadata):
     28        (WebCore::Entry::moveTo):
     29        (WebCore::Entry::copyTo):
     30        (WebCore::Entry::remove):
     31        (WebCore::Entry::getParent):
     32        * fileapi/EntrySync.cpp:
     33        (WebCore::EntrySync::getMetadata):
     34        (WebCore::EntrySync::moveTo):
     35        (WebCore::EntrySync::copyTo):
     36        (WebCore::EntrySync::remove):
     37        * fileapi/FileError.h: Added error code enum.
     38        (WebCore::FileError::create):
     39        (WebCore::FileError::code):
     40        (WebCore::FileError::FileError):
     41        * fileapi/FileError.idl: Rebased error code numbers.
     42        * fileapi/FileException.h: Added exception code enum.
     43        (WebCore::FileException::ErrorCodeToExceptionCode): Added.
     44        * fileapi/FileException.idl: Rebased exception code numbers.
     45        * fileapi/FileReader.cpp:
     46        (WebCore::FileReader::abort):
     47        (WebCore::FileReader::failed):
     48        (WebCore::FileReader::httpStatusCodeToErrorCode): Changed from
     49        httpStatuCodeToExceptionCode.
     50        * fileapi/FileReader.h:
     51        * fileapi/FileReaderSync.cpp:
     52        (WebCore::FileReaderSyncLoader::start):
     53        * fileapi/FileSystemCallbacks.cpp:
     54        (WebCore::FileSystemCallbacksBase::didFail):
     55        * fileapi/FileWriter.cpp:
     56        (WebCore::FileWriter::write):
     57        (WebCore::FileWriter::seek):
     58        (WebCore::FileWriter::truncate):
     59        (WebCore::FileWriter::abort):
     60        (WebCore::FileWriter::didFail):
     61        (WebCore::FileWriter::setError):
     62        * fileapi/FileWriter.h:
     63        * fileapi/SyncCallbackHelper.h:
     64        (WebCore::SyncCallbackHelper::SyncCallbackHelper):
     65        (WebCore::SyncCallbackHelper::getResult):
     66        (WebCore::SyncCallbackHelper::setError):
     67        * page/DOMWindow.cpp:
     68        (WebCore::DOMWindow::requestFileSystem):
     69        * workers/WorkerContext.cpp:
     70        (WebCore::WorkerContext::requestFileSystem):
     71        (WebCore::WorkerContext::requestFileSystemSync):
     72
    1732010-10-24  Dan Bernstein  <mitz@apple.com>
    274
  • trunk/WebCore/bindings/js/JSDOMBinding.cpp

    r69688 r70438  
    7777#include "JSSQLException.h"
    7878#include "SQLException.h"
     79#endif
     80
     81#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     82#include "FileException.h"
     83#include "JSFileException.h"
    7984#endif
    8085
     
    620625            break;
    621626#endif
     627#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     628        case FileExceptionType:
     629            errorObject = toJS(exec, globalObject, FileException::create(description));
     630            break;
     631#endif
    622632    }
    623633
  • trunk/WebCore/bindings/v8/V8Proxy.cpp

    r70181 r70438  
    5656#include "V8DOMWindow.h"
    5757#include "V8EventException.h"
     58#include "V8FileException.h"
    5859#include "V8HiddenPropertyName.h"
    5960#include "V8IsolatedContext.h"
     
    704705        break;
    705706#endif
     707#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     708    case FileExceptionType:
     709        exception = toV8(FileException::create(description));
     710        break;
     711#endif
    706712    default:
    707713        ASSERT_NOT_REACHED();
  • trunk/WebCore/dom/ExceptionCode.cpp

    r61531 r70438  
    4343#endif
    4444
     45#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     46#include "FileException.h"
     47#endif
     48
    4549namespace WebCore {
    4650
     
    171175    "A constraint was violated.",
    172176    "A transaction lock could not be acquired in a reasonable time."
     177};
     178#endif
     179
     180#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     181static const char* const fileExceptionNames[] = {
     182    "NOT_FOUND_ERR",
     183    "SECURITY_ERR",
     184    "ABORT_ERR",
     185    "NOT_READABLE_ERR",
     186    "ENCODING_ERR",
     187    "NO_MODIFICATION_ALLOWED_ERR",
     188    "INVALID_STATE_ERR",
     189    "SYNTAX_ERR",
     190    "INVALID_MODIFICATION_ERR",
     191    "QUOTA_EXCEEDED_ERR",
     192    "TYPE_MISMATCH_ERR",
     193    "PATH_EXISTS_ERR"
     194};
     195
     196static const char* const fileExceptionDescriptions[] = {
     197    "A requested file or directory could not be found at the time an operation was processed.",
     198    "It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.",
     199    "An ongoing operation was aborted, typically with a call to abort().",
     200    "The requested file could not be read, typically due to permission problems that have occured after a reference to a file was acquired.",
     201    "A URI supplied to the API was malformed, or the resulting Data URL has exceeded the URL length limitations for Data URLs.",
     202    "An attempt was made to write to a file or directory which could not be modified due to the state of the underlying filesystem.",
     203    "An operation that depends on state cached in an interface object was made but the state had changed since it was read from disk.",
     204    "An invalid or unsupported argument was given, like an invalid line ending specifier.",
     205    "The modification request was illegal.",
     206    "The operation failed because it would cause the application to exceed its storage quota.",
     207    "The path supplied exists, but was not an entry of requested type.",
     208    "An attempt was made to create a file or directory where an element already exists."
    173209};
    174210#endif
     
    242278        nameTableOffset = SQLException::UNKNOWN_ERR;
    243279#endif
     280#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     281    } else if (code >= FileException::FileExceptionOffset && code <= FileException::FileExceptionMax) {
     282        type = FileExceptionType;
     283        typeName = "DOM File";
     284        code -= FileException::FileExceptionOffset;
     285        nameTable = fileExceptionNames;
     286        descriptionTable = fileExceptionDescriptions;
     287        nameTableSize = sizeof(fileExceptionNames) / sizeof(fileExceptionNames[0]);
     288        nameTableOffset = FileException::NOT_FOUND_ERR;
     289#endif
    244290    } else {
    245291        type = DOMExceptionType;
  • trunk/WebCore/dom/ExceptionCode.h

    r67614 r70438  
    8282        , SQLExceptionType
    8383#endif
     84#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
     85        , FileExceptionType
     86#endif
    8487    };
    8588
  • trunk/WebCore/fileapi/AsyncFileWriterClient.h

    r68242 r70438  
    3434#if ENABLE(FILE_SYSTEM)
    3535
    36 #include "ExceptionCode.h"
     36#include "FileError.h"
    3737
    3838namespace WebCore {
     
    4444    virtual void didWrite(long long bytes, bool complete) = 0;
    4545    virtual void didTruncate() = 0;
    46     virtual void didFail(ExceptionCode) = 0;
     46    virtual void didFail(FileError::ErrorCode) = 0;
    4747};
    4848
  • trunk/WebCore/fileapi/DirectoryEntry.cpp

    r69485 r70438  
    5656    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    5757    if (!m_fileSystem->getFile(this, path, flags, successCallback, errorCallback))
    58         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     58        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    5959}
    6060
     
    6363    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    6464    if (!m_fileSystem->getDirectory(this, path, flags, successCallback, errorCallback))
    65         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     65        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    6666}
    6767
     
    7070    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    7171    if (!m_fileSystem->removeRecursively(this, successCallback, errorCallback))
    72         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     72        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    7373}
    7474
  • trunk/WebCore/fileapi/DirectoryEntrySync.cpp

    r69485 r70438  
    3737#include "EntrySync.h"
    3838#include "FileEntrySync.h"
     39#include "FileException.h"
    3940#include "SyncCallbackHelper.h"
    4041
     
    5657    EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    5758    if (!m_fileSystem->getFile(this, path, flags, helper.successCallback(), helper.errorCallback())) {
    58         ec = INVALID_MODIFICATION_ERR;
     59        ec = FileException::INVALID_MODIFICATION_ERR;
    5960        return 0;
    6061    }
     
    6768    EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    6869    if (!m_fileSystem->getDirectory(this, path, flags, helper.successCallback(), helper.errorCallback())) {
    69         ec = INVALID_MODIFICATION_ERR;
     70        ec = FileException::INVALID_MODIFICATION_ERR;
    7071        return 0;
    7172    }
     
    7879    VoidSyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    7980    if (!m_fileSystem->removeRecursively(this, helper.successCallback(), helper.errorCallback())) {
    80         ec = INVALID_MODIFICATION_ERR;
     81        ec = FileException::INVALID_MODIFICATION_ERR;
    8182        return;
    8283    }
  • trunk/WebCore/fileapi/DirectoryReaderSync.cpp

    r69249 r70438  
    4040#include "ExceptionCode.h"
    4141#include "FileEntrySync.h"
    42 #include "FileError.h"
     42#include "FileException.h"
    4343#include "SyncCallbackHelper.h"
    4444
     
    5858    EntriesSyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    5959    if (!m_fileSystem->readDirectory(this, m_fullPath, helper.successCallback(), helper.errorCallback())) {
    60         ec = INVALID_MODIFICATION_ERR;
     60        ec = FileException::INVALID_MODIFICATION_ERR;
    6161        setHasMoreEntries(false);
    6262        return 0;
  • trunk/WebCore/fileapi/Entry.cpp

    r69249 r70438  
    5252    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    5353    if (!m_fileSystem->getMetadata(this, successCallback, errorCallback))
    54         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     54        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    5555}
    5656
     
    5959    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    6060    if (!m_fileSystem->move(this, parent.get(), name, successCallback, errorCallback))
    61         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     61        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    6262}
    6363
     
    6666    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    6767    if (!m_fileSystem->copy(this, parent.get(), name, successCallback, errorCallback))
    68         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     68        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    6969}
    7070
     
    7373    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    7474    if (!m_fileSystem->remove(this, successCallback, errorCallback))
    75         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     75        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    7676}
    7777
     
    8080    RefPtr<ErrorCallback> errorCallback(errorCallbackRef);
    8181    if (!m_fileSystem->getParent(this, successCallback, errorCallback))
    82         filesystem()->scheduleCallback(errorCallback.release(), FileError::create(INVALID_MODIFICATION_ERR));
     82        filesystem()->scheduleCallback(errorCallback.release(), FileError::create(FileError::INVALID_MODIFICATION_ERR));
    8383}
    8484
  • trunk/WebCore/fileapi/EntrySync.cpp

    r69485 r70438  
    3939#include "DirectoryEntrySync.h"
    4040#include "FileEntrySync.h"
     41#include "FileException.h"
    4142#include "Metadata.h"
    4243#include "SyncCallbackHelper.h"
     
    5657    MetadataSyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    5758    if (!m_fileSystem->getMetadata(this, helper.successCallback(), helper.errorCallback())) {
    58         ec = INVALID_MODIFICATION_ERR;
     59        ec = FileException::INVALID_MODIFICATION_ERR;
    5960        return 0;
    6061    }
     
    6768    EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    6869    if (!m_fileSystem->move(this, parent.get(), name, helper.successCallback(), helper.errorCallback())) {
    69         ec = INVALID_MODIFICATION_ERR;
     70        ec = FileException::INVALID_MODIFICATION_ERR;
    7071        return 0;
    7172    }
     
    7879    EntrySyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    7980    if (!m_fileSystem->copy(this, parent.get(), name, helper.successCallback(), helper.errorCallback())) {
    80         ec = INVALID_MODIFICATION_ERR;
     81        ec = FileException::INVALID_MODIFICATION_ERR;
    8182        return 0;
    8283    }
     
    8990    VoidSyncCallbackHelper helper(m_fileSystem->asyncFileSystem());
    9091    if (!m_fileSystem->remove(this, helper.successCallback(), helper.errorCallback())) {
    91         ec = INVALID_MODIFICATION_ERR;
     92        ec = FileException::INVALID_MODIFICATION_ERR;
    9293        return;
    9394    }
  • trunk/WebCore/fileapi/FileError.h

    r67614 r70438  
    3434#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
    3535
    36 #include "ExceptionCode.h"
    3736#include <wtf/PassRefPtr.h>
    3837#include <wtf/RefCounted.h>
     
    4241class FileError : public RefCounted<FileError> {
    4342public:
    44     static PassRefPtr<FileError> create(ExceptionCode code) { return adoptRef(new FileError(code)); }
     43    enum ErrorCode {
     44        NOT_FOUND_ERR = 1,
     45        SECURITY_ERR = 2,
     46        ABORT_ERR = 3,
     47        NOT_READABLE_ERR = 4,
     48        ENCODING_ERR = 5,
     49        NO_MODIFICATION_ALLOWED_ERR = 6,
     50        INVALID_STATE_ERR = 7,
     51        SYNTAX_ERR = 8,
     52        INVALID_MODIFICATION_ERR = 9,
     53        QUOTA_EXCEEDED_ERR = 10,
     54        TYPE_MISMATCH_ERR = 11,
     55        PATH_EXISTS_ERR = 12,
     56    };
    4557
    46     ExceptionCode code() const { return m_code; }
     58    static PassRefPtr<FileError> create(ErrorCode code) { return adoptRef(new FileError(code)); }
     59
     60    ErrorCode code() const { return m_code; }
    4761
    4862private:
    49     FileError(ExceptionCode code)
     63    FileError(ErrorCode code)
    5064        : m_code(code)
    5165    { }
    5266
    53     ExceptionCode m_code;
     67    ErrorCode m_code;
    5468};
    5569
  • trunk/WebCore/fileapi/FileError.idl

    r67614 r70438  
    3232    interface [
    3333        Conditional=BLOB|FILE_SYSTEM,
    34         DontCheckEnums,
    3534        NoStaticTables
    3635    ] FileError {
    3736#if !defined(LANGUAGE_OBJECTIVE_C)
    38         const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
    39         const unsigned short NOT_FOUND_ERR = 8;
    40         const unsigned short INVALID_STATE_ERR = 11;
    41         const unsigned short SYNTAX_ERR = 12;
    42         const unsigned short INVALID_MODIFICATION_ERR = 13;
     37        // FIXME: Some of constant names are already defined in DOMException.h for Objective-C binding and we cannot have the same names here (they are translated into a enum in the same namespace).
     38        const unsigned short NOT_FOUND_ERR = 1;
     39        const unsigned short SECURITY_ERR = 2;
     40        const unsigned short ABORT_ERR = 3;
     41        const unsigned short NOT_READABLE_ERR = 4;
     42        const unsigned short ENCODING_ERR = 5;
     43        const unsigned short NO_MODIFICATION_ALLOWED_ERR = 6;
     44        const unsigned short INVALID_STATE_ERR = 7;
     45        const unsigned short SYNTAX_ERR = 8;
     46        const unsigned short INVALID_MODIFICATION_ERR = 9;
     47        const unsigned short QUOTA_EXCEEDED_ERR = 10;
     48        const unsigned short TYPE_MISMATCH_ERR = 11;
     49        const unsigned short PATH_EXISTS_ERR = 12;
    4350#endif
    44         const unsigned short SECURITY_ERR = 18;
    45         const unsigned short ABORT_ERR = 20;
    46         const unsigned short QUOTA_EXCEEDED_ERR = 22;
    47         const unsigned short NOT_READABLE_ERR = 24;
    48         const unsigned short ENCODING_ERR = 26;
    4951        readonly attribute unsigned short code;
    5052    };
  • trunk/WebCore/fileapi/FileException.h

    r67614 r70438  
    4545    }
    4646
    47     static const int FileExceptionOffset = 100;
    48     static const int FileExceptionMax = 199;
     47    static const int FileExceptionOffset = 1100;
     48    static const int FileExceptionMax = 1199;
    4949
    50     enum EventExceptionCode {
    51         UNSPECIFIED_EVENT_TYPE_ERR = FileExceptionOffset
     50    enum FileExceptionCode {
     51        NOT_FOUND_ERR = FileExceptionOffset + 1,
     52        SECURITY_ERR = FileExceptionOffset + 2,
     53        ABORT_ERR = FileExceptionOffset + 3,
     54        NOT_READABLE_ERR = FileExceptionOffset + 4,
     55        ENCODING_ERR = FileExceptionOffset + 5,
     56        NO_MODIFICATION_ALLOWED_ERR = FileExceptionOffset + 6,
     57        INVALID_STATE_ERR = FileExceptionOffset + 7,
     58        SYNTAX_ERR = FileExceptionOffset + 8,
     59        INVALID_MODIFICATION_ERR = FileExceptionOffset + 9,
     60        QUOTA_EXCEEDED_ERR = FileExceptionOffset + 10,
     61        TYPE_MISMATCH_ERR = FileExceptionOffset + 11,
     62        PATH_EXISTS_ERR = FileExceptionOffset + 12,
    5263    };
     64
     65    static int ErrorCodeToExceptionCode(int errorCode)
     66    {
     67        if (!errorCode)
     68            return 0;
     69        return errorCode + FileExceptionOffset;
     70    }
    5371
    5472private:
     
    6482
    6583#endif // FileException_h
    66 
  • trunk/WebCore/fileapi/FileException.idl

    r67614 r70438  
    4646
    4747        // FileExceptionCode
    48         const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
    49         const unsigned short NOT_FOUND_ERR = 8;
    50         const unsigned short INVALID_STATE_ERR = 11;
    51         const unsigned short SYNTAX_ERR = 12;
    52         const unsigned short INVALID_MODIFICATION_ERR = 13;
    53         const unsigned short SECURITY_ERR = 18;
    54         const unsigned short ABORT_ERR = 20;
    55         const unsigned short QUOTA_EXCEEDED_ERR = 22;
    56         const unsigned short NOT_READABLE_ERR = 24;
    57         const unsigned short ENCODING_ERR = 26;
     48        const unsigned short NOT_FOUND_ERR = 1;
     49        const unsigned short SECURITY_ERR = 2;
     50        const unsigned short ABORT_ERR = 3;
     51        const unsigned short NOT_READABLE_ERR = 4;
     52        const unsigned short ENCODING_ERR = 5;
     53        const unsigned short NO_MODIFICATION_ALLOWED_ERR = 6;
     54        const unsigned short INVALID_STATE_ERR = 7;
     55        const unsigned short SYNTAX_ERR = 8;
     56        const unsigned short INVALID_MODIFICATION_ERR = 9;
     57        const unsigned short QUOTA_EXCEEDED_ERR = 10;
     58        const unsigned short TYPE_MISMATCH_ERR = 11;
     59        const unsigned short PATH_EXISTS_ERR = 12;
    5860    };
    5961}
  • trunk/WebCore/fileapi/FileReader.cpp

    r69688 r70438  
    146146
    147147    m_builder.clear();
    148     m_error = FileError::create(ABORT_ERR);
     148    m_error = FileError::create(FileError::ABORT_ERR);
    149149
    150150    fireEvent(eventNames().errorEvent);
     
    256256    m_state = Completed;
    257257
    258      m_error = FileError::create(httpStatusCodeToExceptionCode(httpStatusCode));
     258     m_error = FileError::create(httpStatusCodeToErrorCode(httpStatusCode));
    259259    fireEvent(eventNames().errorEvent);
    260260    fireEvent(eventNames().loadendEvent);
     
    263263}
    264264
    265 ExceptionCode FileReader::httpStatusCodeToExceptionCode(int httpStatusCode)
     265FileError::ErrorCode FileReader::httpStatusCodeToErrorCode(int httpStatusCode)
    266266{
    267267    switch (httpStatusCode) {
    268268        case 403:
    269             return SECURITY_ERR;
     269            return FileError::SECURITY_ERR;
    270270        case 404:
    271             return NOT_FOUND_ERR;
     271            return FileError::NOT_FOUND_ERR;
    272272        default:
    273             return NOT_READABLE_ERR;
     273            return FileError::NOT_READABLE_ERR;
    274274    }
    275275}
  • trunk/WebCore/fileapi/FileReader.h

    r69688 r70438  
    8181
    8282    // Helper methods, also used by FileReaderSync.
    83     static ExceptionCode httpStatusCodeToExceptionCode(int httpStatusCode);
     83    static FileError::ErrorCode httpStatusCodeToErrorCode(int httpStatusCode);
    8484    static void convertToDataURL(const Vector<char>& rawData, const String& fileType, StringBuilder&);
    8585
  • trunk/WebCore/fileapi/FileReaderSync.cpp

    r69688 r70438  
    3838#include "Blob.h"
    3939#include "BlobURL.h"
     40#include "FileException.h"
    4041#include "FileReader.h"
    4142#include "ResourceRequest.h"
     
    9293    ThreadableLoader::loadResourceSynchronously(scriptExecutionContext, request, *this, options);
    9394
    94     ec = (m_httpStatusCode == 200) ? 0 : FileReader::httpStatusCodeToExceptionCode(m_httpStatusCode);
     95    ec = (m_httpStatusCode == 200) ? 0 : FileException::ErrorCodeToExceptionCode(FileReader::httpStatusCodeToErrorCode(m_httpStatusCode));
    9596}
    9697
  • trunk/WebCore/fileapi/FileSystemCallbacks.cpp

    r69249 r70438  
    4444#include "EntryCallback.h"
    4545#include "ErrorCallback.h"
    46 #include "ExceptionCode.h"
    4746#include "FileEntry.h"
    4847#include "FileError.h"
     
    105104{
    106105    if (m_errorCallback) {
    107         m_errorCallback->handleEvent(FileError::create(code).get());
     106        m_errorCallback->handleEvent(FileError::create(static_cast<FileError::ErrorCode>(code)).get());
    108107        m_errorCallback.clear();
    109108    }
  • trunk/WebCore/fileapi/FileWriter.cpp

    r69560 r70438  
    3939#include "ExceptionCode.h"
    4040#include "FileError.h"
     41#include "FileException.h"
    4142#include "ProgressEvent.h"
    4243
     
    9192    ASSERT(m_writer);
    9293    if (m_readyState == WRITING) {
    93         ec = INVALID_STATE_ERR;
    94         m_error = FileError::create(ec);
     94        setError(FileError::INVALID_STATE_ERR, ec);
    9595        return;
    9696    }
    9797    if (!data) {
    98         ec = TYPE_MISMATCH_ERR;
    99         m_error = FileError::create(ec);
     98        setError(FileError::TYPE_MISMATCH_ERR, ec);
    10099        return;
    101100    }
     
    113112    ASSERT(m_writer);
    114113    if (m_readyState == WRITING) {
    115         ec = INVALID_STATE_ERR;
    116         m_error = FileError::create(ec);
     114        setError(FileError::INVALID_STATE_ERR, ec);
    117115        return;
    118116    }
     
    133131    ASSERT(m_writer);
    134132    if (m_readyState == WRITING || position < 0) {
    135         ec = INVALID_STATE_ERR;
    136         m_error = FileError::create(ec);
     133        setError(FileError::INVALID_STATE_ERR, ec);
    137134        return;
    138135    }
     
    148145    ASSERT(m_writer);
    149146    if (m_readyState != WRITING) {
    150         ec = INVALID_STATE_ERR;
    151         m_error = FileError::create(ec);
    152         return;
    153     }
    154    
    155     m_error = FileError::create(ABORT_ERR);
     147        setError(FileError::INVALID_STATE_ERR, ec);
     148        return;
     149    }
     150
     151    m_error = FileError::create(FileError::ABORT_ERR);
    156152    m_writer->abort();
    157153}
     
    192188}
    193189
    194 void FileWriter::didFail(ExceptionCode ec)
    195 {
    196     m_error = FileError::create(ec);
     190void FileWriter::didFail(FileError::ErrorCode code)
     191{
     192    m_error = FileError::create(code);
    197193    fireEvent(eventNames().errorEvent);
    198     if (ABORT_ERR == ec)
     194    if (FileError::ABORT_ERR == code)
    199195        fireEvent(eventNames().abortEvent);
    200196    fireEvent(eventNames().errorEvent);
     
    210206}
    211207
     208void FileWriter::setError(FileError::ErrorCode errorCode, ExceptionCode& ec)
     209{
     210    ec = FileException::ErrorCodeToExceptionCode(errorCode);
     211    m_error = FileError::create(errorCode);
     212}
     213
    212214} // namespace WebCore
    213  
     215
    214216#endif // ENABLE(FILE_SYSTEM)
  • trunk/WebCore/fileapi/FileWriter.h

    r69560 r70438  
    7878    void didWrite(long long bytes, bool complete);
    7979    void didTruncate();
    80     void didFail(ExceptionCode ec);
     80    void didFail(FileError::ErrorCode);
    8181
    8282    // ActiveDOMObject
     
    9898    DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
    9999    DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend);
    100    
     100
    101101private:
    102102    FileWriter(ScriptExecutionContext*);
     
    113113
    114114    void fireEvent(const AtomicString& type);
     115
     116    void setError(FileError::ErrorCode, ExceptionCode&);
    115117
    116118    RefPtr<FileError> m_error;
  • trunk/WebCore/fileapi/SyncCallbackHelper.h

    r69249 r70438  
    4242#include "FileEntry.h"
    4343#include "FileError.h"
     44#include "FileException.h"
    4445#include "FileSystemCallback.h"
    4546#include "MetadataCallback.h"
     
    6566        , m_successCallback(SuccessCallbackImpl::create(this))
    6667        , m_errorCallback(ErrorCallbackImpl::create(this))
    67         , m_error(0)
     68        , m_exceptionCode(0)
    6869        , m_completed(false)
    6970    {
     
    7576            while (!m_completed) {
    7677                if (!m_observer->waitForOperationToComplete()) {
    77                     m_error = ABORT_ERR;
     78                    m_exceptionCode = FileException::ABORT_ERR;
    7879                    break;
    7980                }
    8081            }
    8182        }
    82         ec = m_error;
     83        ec = m_exceptionCode;
    8384        return m_result.release();
    8485    }
     
    139140    friend class ErrorCallbackImpl;
    140141
    141     void setError(ExceptionCode ec)
     142    void setError(int code)
    142143    {
    143         m_error = ec;
     144        m_exceptionCode = FileException::ErrorCodeToExceptionCode(code);
    144145        m_completed = true;
    145146    }
     
    155156    RefPtr<ErrorCallbackImpl> m_errorCallback;
    156157    RefPtr<ResultType> m_result;
    157     ExceptionCode m_error;
     158    ExceptionCode m_exceptionCode;
    158159    bool m_completed;
    159160};
  • trunk/WebCore/page/DOMWindow.cpp

    r70335 r70438  
    731731
    732732    if (!AsyncFileSystem::isAvailable() || !document->securityOrigin()->canAccessFileSystem()) {
    733         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(SECURITY_ERR));
     733        DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::SECURITY_ERR));
    734734        return;
    735735    }
     
    737737    AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
    738738    if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) {
    739         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
     739        DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
    740740        return;
    741741    }
  • trunk/WebCore/workers/WorkerContext.cpp

    r70102 r70438  
    7070#include "ErrorCallback.h"
    7171#include "FileError.h"
     72#include "FileException.h"
    7273#include "FileSystemCallback.h"
    7374#include "FileSystemCallbacks.h"
     
    356357{
    357358    if (!AsyncFileSystem::isAvailable() || !securityOrigin()->canAccessFileSystem()) {
    358         DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(SECURITY_ERR));
     359        DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(FileError::SECURITY_ERR));
    359360        return;
    360361    }
     
    362363    AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
    363364    if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) {
    364         DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
     365        DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
    365366        return;
    366367    }
     
    373374    ec = 0;
    374375    if (!AsyncFileSystem::isAvailable() || !securityOrigin()->canAccessFileSystem()) {
    375         ec = SECURITY_ERR;
     376        ec = FileException::SECURITY_ERR;
    376377        return 0;
    377378    }
     
    379380    AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
    380381    if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent) {
    381         ec = INVALID_MODIFICATION_ERR;
     382        ec = FileException::INVALID_MODIFICATION_ERR;
    382383        return 0;
    383384    }
  • trunk/WebKit/chromium/ChangeLog

    r70430 r70438  
     12010-10-20  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Reviewed by Jian Li.
     4
     5        Renumber FileError/FileException error codes per latest File API spec changes
     6        https://bugs.webkit.org/show_bug.cgi?id=47936
     7
     8        * public/WebFileError.h:
     9        * src/AssertMatchingEnums.cpp:
     10        * src/AsyncFileWriterChromium.cpp:
     11        (WebCore::AsyncFileWriterChromium::didFail):
     12
    1132010-10-24  Sheriff Bot  <webkit.review.bot@gmail.com>
    214
  • trunk/WebKit/chromium/public/WebFileError.h

    r65718 r70438  
    3535// File-related error code defined in HTML5 File API.
    3636enum WebFileError {
    37     WebFileErrorNoModificationAllowed = 7,
    38     WebFileErrorNotFound = 8,
    39     WebFileErrorInvalidState = 11,
    40     WebFileErrorInvalidModification = 13,
    41     WebFileErrorSecurity = 18,
    42     WebFileErrorAbort = 20,
    43     WebFileErrorQuotaExceeded = 22,
    44     WebFileErrorNotReadable = 24,
    45     WebFileErrorEncoding = 26,
     37    WebFileErrorNotFound = 1,
     38    WebFileErrorSecurity = 2,
     39    WebFileErrorAbort = 3,
     40    WebFileErrorNotReadable = 4,
     41    WebFileErrorEncoding = 5,
     42    WebFileErrorNoModificationAllowed = 6,
     43    WebFileErrorInvalidState = 7,
     44    WebFileErrorSyntax = 8,
     45    WebFileErrorInvalidModification = 9,
     46    WebFileErrorQuotaExceeded = 10,
     47    WebFileErrorTypeMismatch = 11,
     48    WebFileErrorPathExists = 12,
    4649};
    4750
  • trunk/WebKit/chromium/src/AssertMatchingEnums.cpp

    r69163 r70438  
    3838#include "AsyncFileSystem.h"
    3939#include "EditorInsertAction.h"
     40#include "FileError.h"
    4041#include "FontDescription.h"
    4142#include "FontSmoothingMode.h"
     
    5758#include "WebCursorInfo.h"
    5859#include "WebEditingAction.h"
     60#include "WebFileError.h"
    5961#include "WebFileSystem.h"
    6062#include "WebFontDescription.h"
     
    363365COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent);
    364366#endif
     367
     368COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNotFound, FileError::NOT_FOUND_ERR);
     369COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorSecurity, FileError::SECURITY_ERR);
     370COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorAbort, FileError::ABORT_ERR);
     371COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNotReadable, FileError::NOT_READABLE_ERR);
     372COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorEncoding, FileError::ENCODING_ERR);
     373COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNoModificationAllowed, FileError::NO_MODIFICATION_ALLOWED_ERR);
     374COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorInvalidState, FileError::INVALID_STATE_ERR);
     375COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorSyntax, FileError::SYNTAX_ERR);
     376COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorInvalidModification, FileError::INVALID_MODIFICATION_ERR);
     377COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorQuotaExceeded, FileError::QUOTA_EXCEEDED_ERR);
     378COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorTypeMismatch, FileError::TYPE_MISMATCH_ERR);
     379COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorPathExists, FileError::PATH_EXISTS_ERR);
  • trunk/WebKit/chromium/src/AsyncFileWriterChromium.cpp

    r68242 r70438  
    8686void AsyncFileWriterChromium::didFail(WebKit::WebFileError error)
    8787{
    88     m_client->didFail(error);
     88    m_client->didFail(static_cast<FileError::ErrorCode>(error));
    8989}
    9090
Note: See TracChangeset for help on using the changeset viewer.