Bug 45498

Summary: [FileSystem] Do not call EntriesCallback more than once if there're no entries.
Product: WebKit Reporter: Kinuko Yasuda <kinuko>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dumi, ericu, fishd, jianli, kkanetkar
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch dumi: review+

Description Kinuko Yasuda 2010-09-09 15:26:14 PDT
DirectoryReader.readDirectory should not call EntriesCallback twice if there're no entries.
Currently it wrongly calls the callback twice (one to return entries that is empty and the other one to indicate there's no more entries.)

http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-directoryreader-interface
Comment 1 Kinuko Yasuda 2010-09-09 15:35:32 PDT
Created attachment 67103 [details]
Patch
Comment 2 Dumitru Daniliuc 2010-09-09 23:00:35 PDT
Comment on attachment 67103 [details]
Patch

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

r=me, but please address the comments before submitting.

> WebCore/fileapi/FileSystemCallbacks.cpp:150
> +        if (!hasMore && hadEntries) {
i don't think you need the hadEntries variable. can you just use: if (!hasMore && !m_entries->isEmpty()) and clear m_entries after the if-block?

> WebCore/fileapi/FileSystemCallbacks.cpp:151
>              // If there're no more entries, call back once more with an empty array.
update the comment please.
Comment 3 Kinuko Yasuda 2010-09-10 11:44:19 PDT
Committed r67220: <http://trac.webkit.org/changeset/67220>