Bug 84135

Summary: Support cross-filesystem operations in FileSystem API
Product: WebKit Reporter: Kinuko Yasuda <kinuko>
Component: WebKit Misc.Assignee: Kinuko Yasuda <kinuko>
Status: RESOLVED FIXED    
Severity: Normal CC: chutten, dglazkov, ericu, levin, michaeln, tzik, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-03
none
Patch
none
Patch levin: review+

Description Kinuko Yasuda 2012-04-17 02:13:30 PDT
Support cross-filesystem operations in FileSystem API.  FileSystem API spec itself does not prohibit cross-filesystem operations, like copy or move across different filesystems, but our implementation does not seem to support it.
Comment 1 Kinuko Yasuda 2012-04-18 02:36:23 PDT
Created attachment 137661 [details]
Patch
Comment 2 Kinuko Yasuda 2012-04-18 02:40:30 PDT
Sorry this patch is kinda huge, but most of the changes are just moving some code piece from one file to another.  The gist of this patch is:
1) stop passing file paths (without origin/filesystem-type info) to platform layer (i.e. AsyncFileSystem layer) but instead pass complete filesystem URL,
2) keep filesystem type and rootURL information in DOMFileSystem rather than in platform layer, and
3) make relevant code relocation for 2).
This change is very important for supporting cross-filesystem operation.  Eric, would you be able to take the first look at the patch?  Thanks.
Comment 3 Michael Nordman 2012-04-19 12:07:49 PDT
Comment on attachment 137661 [details]
Patch

Yup, this is a huge'ish patch alright!

> Source/WebCore/Modules/filesystem/LocalFileSystem.h:59
> +    void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, FileSystemSynchronousMode = SynchronousFileSystem);

Is the change from 'asycn' to 'sync' behavior in the default parameter value intentional?
Comment 4 Kinuko Yasuda 2012-04-19 23:03:04 PDT
Created attachment 138046 [details]
Patch
Comment 5 Kinuko Yasuda 2012-04-19 23:24:40 PDT
Comment on attachment 137661 [details]
Patch

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

>> Source/WebCore/Modules/filesystem/LocalFileSystem.h:59
>> +    void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, FileSystemSynchronousMode = SynchronousFileSystem);
> 
> Is the change from 'asycn' to 'sync' behavior in the default parameter value intentional?

Oops good catch... fixed.
Comment 6 Eric U. 2012-04-20 17:19:51 PDT
I'll take a look on Monday; sorry for the delay, but the webkit meeting threw off my week.
Comment 7 Eric U. 2012-04-23 13:16:01 PDT
Comment on attachment 138046 [details]
Patch

Looks generally good.  Small points below.

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

> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:75
> +        // FIXME: Remove this clause once http://codereview.chromium.org/7811006

It landed a while back; mind trimming this dead code while you're in there?
If we don't have an innerURL, the URL isn't valid, and we should return false.

> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:129
> +    return KURL(ParsedURLString, url);

Why are we not just returning url?  What does the extra constructor call do?

> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:144
> +    // chromium and is validated each time in the chromium port.

This comment needs rewriting for clarity, and "to the chromium" doesn't make sense.  I realize it isn't a new comment, but deleting it would be better than leaving it as-is.

> Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp:52
>  namespace {

Make sure you copy all relevant changes into AsyncFileSystemBlackBerry.cpp and AsyncFileSystemGtk.cpp.
Comment 8 Kinuko Yasuda 2012-04-24 02:06:14 PDT
Created attachment 138521 [details]
Patch
Comment 9 Kinuko Yasuda 2012-04-24 02:07:18 PDT
Comment on attachment 138046 [details]
Patch

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

>> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:75
>> +        // FIXME: Remove this clause once http://codereview.chromium.org/7811006
> 
> It landed a while back; mind trimming this dead code while you're in there?
> If we don't have an innerURL, the URL isn't valid, and we should return false.

Done.

>> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:129
>> +    return KURL(ParsedURLString, url);
> 
> Why are we not just returning url?  What does the extra constructor call do?

Nope, this should just return url. Fixed.

>> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:144
>> +    // chromium and is validated each time in the chromium port.
> 
> This comment needs rewriting for clarity, and "to the chromium" doesn't make sense.  I realize it isn't a new comment, but deleting it would be better than leaving it as-is.

I updated the comment.  What it wants to say is that the root URL we create here is going to be validated in the browser process each time a request (which contains the root URL) is processed.

> Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp:53
>  

Thanks for pointing it out... I haven't realized they have the files.  Done.
Comment 10 WebKit Review Bot 2012-04-24 13:43:15 PDT
Comment on attachment 138521 [details]
Patch

Attachment 138521 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12527339

New failing tests:
svg/carto.net/colourpicker.svg
Comment 11 WebKit Review Bot 2012-04-24 13:43:27 PDT
Created attachment 138632 [details]
Archive of layout-test-results from ec2-cr-linux-03

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-03  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 12 Kinuko Yasuda 2012-04-26 04:36:16 PDT
Created attachment 138977 [details]
Patch

rebased.
Comment 13 Eric U. 2012-04-30 16:08:08 PDT
Comment on attachment 138977 [details]
Patch

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

I'm assuming the GTK changes compile; I'm sure those folks will mention it if they don't.  LGTM, and thanks for the cleanup.

> Source/WebKit/chromium/ChangeLog:5
> +        Need a short description and bug URL (OOPS!)

Needs comments here.
Comment 14 Kinuko Yasuda 2012-05-04 09:22:46 PDT
Thanks!

(In reply to comment #13)
> (From update of attachment 138977 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=138977&action=review
> 
> I'm assuming the GTK changes compile; I'm sure those folks will mention it if they don't.  LGTM, and thanks for the cleanup.
>
> > Source/WebKit/chromium/ChangeLog:5
> > +        Need a short description and bug URL (OOPS!)
> 
> Needs comments here.

I'll fix this in my next patch or before I submit.

David, now it seems ready for your review-- can you take a look at the patch as a reviewer?  Thanks!
Comment 15 Kinuko Yasuda 2012-05-06 10:55:38 PDT
Comment on attachment 138977 [details]
Patch

I'm separating this into multiple subpatches as this is a bit too big.
Comment 17 Kinuko Yasuda 2012-05-07 07:01:06 PDT
Created attachment 140522 [details]
Patch
Comment 18 Kinuko Yasuda 2012-05-07 07:11:20 PDT
Created a new patch which does not include slightly irrelevant cleanups.  This is still big but hopefully easier to follow.

This patch is also adding the new header file 'FileSystemType.h' to build files (e.g. WebCore.gypi) which was missing in the previous patch.  The reason why I merged the change into this one is this patch also moves the file from platform/ to Modules/filesystem/, so build file change is inevitable if I separately made the change or not.  Hope this makes sense.
Comment 19 David Levin 2012-05-07 08:52:42 PDT
Comment on attachment 140522 [details]
Patch

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

> Source/WebCore/ChangeLog:24
> +        - adding FileSystemType.h entry to build files (e.g. WebCore.gypi, WebCore.xcodeproj etc)

Ok. I got through it. 

Perhaps there could have been a few other smaller pieces to break out but I believe I reviewed this well as is.

Thanks for pulling out the pieces that you did because that made it easier!

> Source/WebKit/chromium/ChangeLog:68
> +2012-04-24  Kinuko Yasuda  <kinuko@chromium.org>

repeated entry.

> Source/WebCore/Modules/filesystem/chromium/DOMFileSystemChromium.cpp:116
> +    // filesystemName.toString();

Please remove this commented out line.
Comment 20 Kinuko Yasuda 2012-05-07 20:34:23 PDT
Committed r116388: <http://trac.webkit.org/changeset/116388>
Comment 21 Chris H-C 2012-05-10 07:14:53 PDT
(In reply to comment #20)
> Committed r116388: <http://trac.webkit.org/changeset/116388>

Uh... not sure how to say this, but your patch doesn't compile in the BlackBerry port, and I'm not sure how it could compile if FILE_SYSTEM is def'd.

Among the problems is FileSystemSynchronousMode, which doesn't exist outside of LocalFileSystem.cpp, and is a mismatch with the signature in LocalFileSystem.h.
Comment 22 Kinuko Yasuda 2012-05-10 09:14:04 PDT
(In reply to comment #21)
> (In reply to comment #20)
> > Committed r116388: <http://trac.webkit.org/changeset/116388>
> 
> Uh... not sure how to say this, but your patch doesn't compile in the BlackBerry port, and I'm not sure how it could compile if FILE_SYSTEM is def'd.
> 
> Among the problems is FileSystemSynchronousMode, which doesn't exist outside of LocalFileSystem.cpp, and is a mismatch with the signature in LocalFileSystem.h.

Oops.  Sorry I think I was careless not to break build with FILE_SYSTEM defines on other ports.  As for the FileSystemSynchronousMode problem it should have been FileSystemSynchronousType (s/Mode/Type/).  If you could wait a few more days I'll try fixing those issues (do you mind filing a bug in the case?).
Comment 23 Chris H-C 2012-05-10 09:19:23 PDT
(In reply to comment #22)
> Oops.  Sorry I think I was careless not to break build with FILE_SYSTEM defines on other ports.  As for the FileSystemSynchronousMode problem it should have been FileSystemSynchronousType (s/Mode/Type/).  If you could wait a few more days I'll try fixing those issues (do you mind filing a bug in the case?).

We've made a local change to that effect, thanks for the confirmation.

I've filed Bug#86103 and CC-ed you on it.
Comment 24 Eric U. 2012-06-06 14:53:56 PDT
*** Bug 61404 has been marked as a duplicate of this bug. ***