Skip to content

Truly independent web browser

LibWebView: Remove cleanup of the legacy shared HTTP cache

Timothy Flynn4df36392480f
diff --git a/Libraries/LibWebView/RequestServerManager.cpp b/Libraries/LibWebView/RequestServerManager.cpp
index 4d2edcb5502..847471b2c0b 100644
--- a/Libraries/LibWebView/RequestServerManager.cpp
+++ b/Libraries/LibWebView/RequestServerManager.cpp
@@ -14,7 +14,6 @@
#include <LibCore/File.h>
#include <LibCrypto/Authentication/HMAC.h>
#include <LibFileSystem/FileSystem.h>
-#include <LibHTTP/Cache/DiskCache.h>
#include <LibHTTP/Cache/Utilities.h>
#include <LibWebView/Application.h>
#include <LibWebView/HelperProcess.h>
@@ -55,9 +54,6 @@ RequestServerManager::RequestServerManager()
if (!uses_site_request_servers())
return;
- // Older versions kept the responses of every site in the cache of the RequestServer with no site.
- HTTP::DiskCache::remove(HTTP::DiskCache::Mode::Normal, LexicalPath { Application::request_server_options().cache_path });
-
m_site_cache_key = load_or_create_site_cache_key();
}
@@ -293,7 +289,7 @@ ByteBuffer RequestServerManager::load_or_create_site_cache_key() const
return key.release_value();
}
- // Nothing can find the caches of sites that were named with another key, or by older versions.
+ // Nothing can find the caches of sites that were named with another key.
(void)FileSystem::remove(sites_directory(), FileSystem::RecursionMode::Allowed);
auto key = MUST(ByteBuffer::create_uninitialized(site_cache_key_size));
diff --git a/Tests/LibWebView/TestRequestServerDiskCaches.cpp b/Tests/LibWebView/TestRequestServerDiskCaches.cpp
index dc7f992f5e8..0249253a1e2 100644
--- a/Tests/LibWebView/TestRequestServerDiskCaches.cpp
+++ b/Tests/LibWebView/TestRequestServerDiskCaches.cpp
@@ -6,7 +6,6 @@
#include "HeadlessTest.h"
#include <AK/LexicalPath.h>
-#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibTest/TestCase.h>
#include <LibWebView/Application.h>
@@ -33,11 +32,6 @@ TEST_CASE(only_sites_of_normal_sessions_have_disk_caches)
auto browser_server = TRY_OR_FAIL(manager.browser_instance(normal_session));
auto shared_cache = LexicalPath::join(browser_server->cache_path(), "Cache"sv).string();
EXPECT(!FileSystem::exists(shared_cache));
-
- // A profile from before sites had RequestServers of their own has a shared cache that nothing uses any more.
- TRY_OR_FAIL(Core::Directory::create(shared_cache, Core::Directory::CreateDirectories::Yes));
- WebView::RequestServerManager new_manager;
- EXPECT(!FileSystem::exists(shared_cache));
}
// A RequestServer can ask whether any path exists, so it must not be able to work out where other sites' caches are.
@@ -65,13 +59,11 @@ TEST_CASE(site_cache_directories_cannot_be_named_without_the_key)
EXPECT_EQ(restarted_server->cache_path(), cache_path.string());
}
- // Directories named by older versions leak the site, and nothing can find them again once the key is gone.
+ // Nothing can find the existing caches again once the key is gone.
auto sites_directory = cache_path.parent();
- auto readable_cache = sites_directory.append("https___normal.example-12345678"sv).string();
- TRY_OR_FAIL(Core::Directory::create(readable_cache, Core::Directory::CreateDirectories::Yes));
TRY_OR_FAIL(FileSystem::remove(sites_directory.parent().append("SiteCacheKey"sv).string(), FileSystem::RecursionMode::Disallowed));
WebView::RequestServerManager new_manager;
- EXPECT(!FileSystem::exists(readable_cache));
+ EXPECT(!FileSystem::exists(cache_path.string()));
EXPECT(FileSystem::exists(sites_directory.parent().append("SiteCacheKey"sv).string()));
}