Bug 58864

Summary: Add overwrite copy/move tests for FileSystem API
Product: WebKit Reporter: Taiju Tsuiki <tzik>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dmikurube, ericu, kinuko, levin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Taiju Tsuiki 2011-04-18 21:58:54 PDT
Add overwrite copy/move tests for FileSystem API.
Currently, layout tests in fast/filesystem for copy/move don't have overwriting test.

Spec says:
> A move of a file on top of an existing file must attempt to delete and replace that file.
> A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#widl-EntrySync-moveTo
Comment 1 Taiju Tsuiki 2011-04-18 23:29:46 PDT
Created attachment 90151 [details]
Patch
Comment 2 Kinuko Yasuda 2011-04-19 07:15:34 PDT
(In reply to comment #0)
> Add overwrite copy/move tests for FileSystem API.
> Currently, layout tests in fast/filesystem for copy/move don't have overwriting test.
> 
> Spec says:
> > A move of a file on top of an existing file must attempt to delete and replace that file.
> > A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
> http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#widl-EntrySync-moveTo

It looks like the spec doesn't explicitly say which error code should be returned when an attempt to copy/move a file on top of a directory is made, and seems like we're returning TYPE_MISMATCH_ERR.

Eric, do you have any idea which error code should be returned in this case?
Maybe INVALID_MODIFICATION_ERR is the right one?
Comment 3 Eric U. 2011-04-19 15:05:42 PDT
(In reply to comment #2)
> (In reply to comment #0)
> > Add overwrite copy/move tests for FileSystem API.
> > Currently, layout tests in fast/filesystem for copy/move don't have overwriting test.
> > 
> > Spec says:
> > > A move of a file on top of an existing file must attempt to delete and replace that file.
> > > A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
> > http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#widl-EntrySync-moveTo
> 
> It looks like the spec doesn't explicitly say which error code should be returned when an attempt to copy/move a file on top of a directory is made, and seems like we're returning TYPE_MISMATCH_ERR.
> 
> Eric, do you have any idea which error code should be returned in this case?
> Maybe INVALID_MODIFICATION_ERR is the right one?

TYPE_MISMATCH_ERR would be OK if the directory to be overwritten was empty, and failed because you were moving a file there.  However, if you were moving a directory on top of a non-empty directory, INVALID_MODIFICATION_ERR is correct.  Let's just make it INVALID_MODIFICATION_ERR for all of them for simplicity, and I'll fix the spec.
Comment 4 Taiju Tsuiki 2011-04-20 02:17:19 PDT
Created attachment 90324 [details]
Patch
Comment 5 Kinuko Yasuda 2011-04-20 04:46:07 PDT
The patch looks good to me.  Thanks!
Comment 6 WebKit Commit Bot 2011-04-20 12:54:23 PDT
Comment on attachment 90324 [details]
Patch

Clearing flags on attachment: 90324

Committed r84408: <http://trac.webkit.org/changeset/84408>
Comment 7 WebKit Commit Bot 2011-04-20 12:54:28 PDT
All reviewed patches have been landed.  Closing bug.