Changeset 252880 in webkit


Ignore:
Timestamp:
Nov 26, 2019 2:28:09 AM (4 years ago)
Author:
Carlos Garcia Campos
Message:

REGRESSION(2.27.2): [GTK] Incognito mode is broken under flatpak
https://bugs.webkit.org/show_bug.cgi?id=203460

Reviewed by Youenn Fablet.

The problem is that in ephemeral sessions the base disk cache directory is null, and Storage::open() ends up
building a cache path with only the version part (/Version n). For some reason g_mkdir_with_parents() doesn't
return -1 in flatpak when it fails to create the directory due to write permission, like in this case. But the
network process ends up crashing later trying to open a directory that doesn't exist.

  • NetworkProcess/NetworkSession.cpp:

(WebKit::NetworkSession::NetworkSession): Do not create the cache if networkCacheDirectory is null.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::Storage::open): Add an ASSERT to ensure we don't receive a null baseCachePath.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r252875 r252880  
     12019-11-26  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(2.27.2): [GTK] Incognito mode is broken under flatpak
     4        https://bugs.webkit.org/show_bug.cgi?id=203460
     5
     6        Reviewed by Youenn Fablet.
     7
     8        The problem is that in ephemeral sessions the base disk cache directory is null, and Storage::open() ends up
     9        building a cache path with only the version part (/Version n). For some reason g_mkdir_with_parents() doesn't
     10        return -1 in flatpak when it fails to create the directory due to write permission, like in this case. But the
     11        network process ends up crashing later trying to open a directory that doesn't exist.
     12
     13        * NetworkProcess/NetworkSession.cpp:
     14        (WebKit::NetworkSession::NetworkSession): Do not create the cache if networkCacheDirectory is null.
     15        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     16        (WebKit::NetworkCache::Storage::open): Add an ASSERT to ensure we don't receive a null baseCachePath.
     17
    1182019-11-25  Yusuke Suzuki  <ysuzuki@apple.com>
    219
  • trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp

    r252840 r252880  
    8888    if (!m_sessionID.isEphemeral()) {
    8989        String networkCacheDirectory = parameters.networkCacheDirectory;
    90         if (!networkCacheDirectory.isNull())
     90        if (!networkCacheDirectory.isNull()) {
    9191            SandboxExtension::consumePermanently(parameters.networkCacheDirectoryExtensionHandle);
    9292
    93         auto cacheOptions = networkProcess.cacheOptions();
     93            auto cacheOptions = networkProcess.cacheOptions();
    9494#if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
    95         if (parameters.networkCacheSpeculativeValidationEnabled)
    96             cacheOptions.add(NetworkCache::CacheOption::SpeculativeRevalidation);
    97 #endif
    98         if (parameters.shouldUseTestingNetworkSession)
    99             cacheOptions.add(NetworkCache::CacheOption::TestingMode);
    100 
    101         m_cache = NetworkCache::Cache::open(networkProcess, networkCacheDirectory, cacheOptions, m_sessionID);
    102 
    103         if (!m_cache)
    104             RELEASE_LOG_ERROR(NetworkCache, "Failed to initialize the WebKit network disk cache");
    105        
     95            if (parameters.networkCacheSpeculativeValidationEnabled)
     96                cacheOptions.add(NetworkCache::CacheOption::SpeculativeRevalidation);
     97#endif
     98            if (parameters.shouldUseTestingNetworkSession)
     99                cacheOptions.add(NetworkCache::CacheOption::TestingMode);
     100
     101            m_cache = NetworkCache::Cache::open(networkProcess, networkCacheDirectory, cacheOptions, m_sessionID);
     102
     103            if (!m_cache)
     104                RELEASE_LOG_ERROR(NetworkCache, "Failed to initialize the WebKit network disk cache");
     105        }
     106
    106107        if (!parameters.resourceLoadStatisticsDirectory.isEmpty())
    107108            SandboxExtension::consumePermanently(parameters.resourceLoadStatisticsDirectoryExtensionHandle);
  • trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp

    r252264 r252880  
    178178{
    179179    ASSERT(RunLoop::isMain());
     180    ASSERT(!baseCachePath.isNull());
    180181
    181182    auto cachePath = makeCachePath(baseCachePath);
Note: See TracChangeset for help on using the changeset viewer.