Changeset 228041 in webkit


Ignore:
Timestamp:
Feb 2, 2018 6:05:54 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

CacheStorage should check for origin file presence when computing the origin of a folder
https://bugs.webkit.org/show_bug.cgi?id=182454

Patch by Youenn Fablet <youenn@apple.com> on 2018-02-02
Reviewed by Chris Dumez.

In case caches is opened for an origin but no cache is added, we do not have a caches name file but we do have an origin filename.
We should be checking the origin filename anyway since we will be reading it afterwards.

  • NetworkProcess/cache/CacheStorageEngineCaches.cpp:

(WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r228033 r228041  
     12018-02-02  Youenn Fablet  <youenn@apple.com>
     2
     3        CacheStorage should check for origin file presence when computing the origin of a folder
     4        https://bugs.webkit.org/show_bug.cgi?id=182454
     5
     6        Reviewed by Chris Dumez.
     7
     8        In case caches is opened for an origin but no cache is added, we do not have a caches name file but we do have an origin filename.
     9        We should be checking the origin filename anyway since we will be reading it afterwards.
     10
     11        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
     12        (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
     13
    1142018-02-02  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp

    r227768 r228041  
    5858void Caches::retrieveOriginFromDirectory(const String& folderPath, WorkQueue& queue, WTF::CompletionHandler<void(std::optional<WebCore::ClientOrigin>&&)>&& completionHandler)
    5959{
    60     queue.dispatch([completionHandler = WTFMove(completionHandler), folderPath = folderPath.isolatedCopy()]() mutable {
    61         if (!WebCore::FileSystem::fileExists(cachesListFilename(folderPath))) {
     60    queue.dispatch([completionHandler = WTFMove(completionHandler), filename = cachesOriginFilename(folderPath)]() mutable {
     61        if (!WebCore::FileSystem::fileExists(filename)) {
    6262            RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() mutable {
    6363                completionHandler(std::nullopt);
     
    6666        }
    6767
    68         auto channel = IOChannel::open(cachesOriginFilename(folderPath), IOChannel::Type::Read);
     68        auto channel = IOChannel::open(filename, IOChannel::Type::Read);
    6969        channel->read(0, std::numeric_limits<size_t>::max(), nullptr, [completionHandler = WTFMove(completionHandler)](const Data& data, int error) mutable {
    7070            ASSERT(RunLoop::isMain());
Note: See TracChangeset for help on using the changeset viewer.