Bug 87969

Summary: [chromium] DataTransferItem.webkitGetAsEntry() should synchronously return entry
Product: WebKit Reporter: Kinuko Yasuda <kinuko>
Component: WebCore Misc.Assignee: Kinuko Yasuda <kinuko>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dcheng, ericu, levin, ojan, tony, tzik, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 76809    
Attachments:
Description Flags
Patch tony: review+

Description Kinuko Yasuda 2012-05-31 06:45:10 PDT
[chromium] DataTransferItem.webkitGetAsEntry() should synchronously return entry.

We were adding DataTransferItem.webkitGetAsEntry(callback) which asynchronously returns FileEntry/DirectoryEntry for drag-and-dropped files, but on the public whatwg ML we got the feedback that this method should synchronously return Entry.
(Right now this is only implemented on chromium)

http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Apr/0079.html
http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Apr/0111.html
Comment 1 Kinuko Yasuda 2012-05-31 07:06:34 PDT
Created attachment 145083 [details]
Patch
Comment 2 Kinuko Yasuda 2012-05-31 23:56:39 PDT
Adding some more filesystem folks to solicit unofficial review.
Comment 3 Tony Chang 2012-06-01 10:48:23 PDT
Comment on attachment 145083 [details]
Patch

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

> Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp:80
> +    // FIXME: This involves synchronous file operation. We need to pass file type data when we dispatch drag event.

If the file on disk changes during the drag, should calls to webkitGetAsEntry() return current information?  If so, you probably can't do this optimization.
Comment 4 Kinuko Yasuda 2012-06-03 08:23:48 PDT
Comment on attachment 145083 [details]
Patch

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

>> Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp:80
>> +    // FIXME: This involves synchronous file operation. We need to pass file type data when we dispatch drag event.
> 
> If the file on disk changes during the drag, should calls to webkitGetAsEntry() return current information?  If so, you probably can't do this optimization.

Good point, it's a bit questionable.  Actually if file<->directory changes we may rather want to return a stale Entry which yields InvalidStateError errors.  I'll update the comment and bring it up on the public list.
Comment 5 Kinuko Yasuda 2012-06-03 22:38:23 PDT
Committed r119371: <http://trac.webkit.org/changeset/119371>