Bug 176166 - Implement FileSystemFileEntry.file()
Summary: Implement FileSystemFileEntry.file()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://wicg.github.io/entries-api/#d...
Keywords: InRadar
Depends on:
Blocks: 175976
  Show dependency treegraph
 
Reported: 2017-08-31 09:46 PDT by Chris Dumez
Modified: 2017-09-02 21:02 PDT (History)
11 users (show)

See Also:


Attachments
Patch (15.69 KB, patch)
2017-09-02 19:45 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (18.29 KB, patch)
2017-09-02 20:32 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-08-31 09:46:06 PDT
Implement FileSystemFileEntry.file():
- https://wicg.github.io/entries-api/#dom-filesystemfileentry-file
Comment 1 Radar WebKit Bug Importer 2017-08-31 09:46:26 PDT
<rdar://problem/34187756>
Comment 2 Chris Dumez 2017-09-02 19:45:51 PDT
Created attachment 319752 [details]
Patch
Comment 3 Sam Weinig 2017-09-02 20:04:18 PDT
Comment on attachment 319752 [details]
Patch

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

> Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp:168
> +    if (!getFileMetadata(fullPath, metadata, ShouldFollowSymbolicLinks::No))
> +        return Exception { NotFoundError, ASCIILiteral("Path does not exist") };

Is it time we had a getFileMetadata that returned an std::optional<FileMetadata> or Expected<FileMetadata>?

> Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp:321
> +    String virtualPath = fileEntry.virtualPath();
> +    String fullPath = evaluatePath(virtualPath);

could use auto here.

> Source/WebCore/Modules/entriesapi/FileSystemFileEntry.cpp:53
> +        if (successCallback)
> +            successCallback->handleEvent(result.releaseReturnValue());

I'm possibly looking at the wrong version of the spec, https://wicg.github.io/entries-api/#api-fileentry, but it looks to me like success callback should not be nullable, so I think you can update the IDL and remove this null check.
Comment 4 Chris Dumez 2017-09-02 20:26:34 PDT
Comment on attachment 319752 [details]
Patch

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

>> Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp:168
>> +        return Exception { NotFoundError, ASCIILiteral("Path does not exist") };
> 
> Is it time we had a getFileMetadata that returned an std::optional<FileMetadata> or Expected<FileMetadata>?

Yes, I can do this in a follow-up.

>> Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp:321
>> +    String fullPath = evaluatePath(virtualPath);
> 
> could use auto here.

Hmm, OK. This is almost the same length :)

>> Source/WebCore/Modules/entriesapi/FileSystemFileEntry.cpp:53
>> +            successCallback->handleEvent(result.releaseReturnValue());
> 
> I'm possibly looking at the wrong version of the spec, https://wicg.github.io/entries-api/#api-fileentry, but it looks to me like success callback should not be nullable, so I think you can update the IDL and remove this null check.

Hmm, you're right. Not sure how I got this wrong. Will fix.
Comment 5 Chris Dumez 2017-09-02 20:32:43 PDT
Created attachment 319755 [details]
Patch
Comment 6 WebKit Commit Bot 2017-09-02 21:02:08 PDT
Comment on attachment 319755 [details]
Patch

Clearing flags on attachment: 319755

Committed r221544: <http://trac.webkit.org/changeset/221544>
Comment 7 WebKit Commit Bot 2017-09-02 21:02:10 PDT
All reviewed patches have been landed.  Closing bug.