Title: [259712] trunk/Source/WebKit
Revision
259712
Author
[email protected]
Date
2020-04-08 03:29:49 -0700 (Wed, 08 Apr 2020)

Log Message

Ensure base cache path exists before calculating disk cache capacity
https://bugs.webkit.org/show_bug.cgi?id=209338

Reviewed by Adrian Perez de Castro.

The base cache path might not exist yet in Cache::open() since it's Storage::open() the one calling
FileSystem::makeAllDirectories() with the final cache directory. In such case, computeCapacity() fails because
FileSystem::getVolumeFreeSpace() needs an existing file.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::open):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (259711 => 259712)


--- trunk/Source/WebKit/ChangeLog	2020-04-08 09:38:51 UTC (rev 259711)
+++ trunk/Source/WebKit/ChangeLog	2020-04-08 10:29:49 UTC (rev 259712)
@@ -1,3 +1,17 @@
+2020-04-08  Carlos Garcia Campos  <[email protected]>
+
+        Ensure base cache path exists before calculating disk cache capacity
+        https://bugs.webkit.org/show_bug.cgi?id=209338
+
+        Reviewed by Adrian Perez de Castro.
+
+        The base cache path might not exist yet in Cache::open() since it's Storage::open() the one calling
+        FileSystem::makeAllDirectories() with the final cache directory. In such case, computeCapacity() fails because
+        FileSystem::getVolumeFreeSpace() needs an existing file.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::Cache::open):
+
 2020-04-08  Keith Rollin  <[email protected]>
 
         Enable the use of XCBuild by default in Apple builds

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp (259711 => 259712)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2020-04-08 09:38:51 UTC (rev 259711)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2020-04-08 10:29:49 UTC (rev 259712)
@@ -78,6 +78,9 @@
 
 RefPtr<Cache> Cache::open(NetworkProcess& networkProcess, const String& cachePath, OptionSet<CacheOption> options, PAL::SessionID sessionID)
 {
+    if (!FileSystem::makeAllDirectories(cachePath))
+        return nullptr;
+
     auto capacity = computeCapacity(networkProcess.cacheModel(), cachePath);
     auto storage = Storage::open(cachePath, options.contains(CacheOption::TestingMode) ? Storage::Mode::AvoidRandomness : Storage::Mode::Normal, capacity);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to