Bug 45498 - [FileSystem] Do not call EntriesCallback more than once if there're no entries.
Summary: [FileSystem] Do not call EntriesCallback more than once if there're no entries.
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2010-09-09 15:26 PDT by Kinuko Yasuda
Modified: 2010-09-10 11:44 PDT (History)
5 users (show)

See Also:

Patch (2.15 KB, patch)
2010-09-09 15:35 PDT, Kinuko Yasuda
dumi: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.)

Comment 1 Kinuko Yasuda 2010-09-09 15:35:32 PDT
Created attachment 67103 [details]
Comment 2 Dumitru Daniliuc 2010-09-09 23:00:35 PDT
Comment on attachment 67103 [details]

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>