summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader/Resource.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-03-23 14:00:01 -0400
committerAndreas Kling <kling@serenityos.org>2022-03-23 21:26:35 +0100
commit20eb441cba5b01147f7ce0bc4127da4b99223ad1 (patch)
tree73d56fdd3aaaa4b22d0dd473798e67d35862b59f /Userland/Libraries/LibWeb/Loader/Resource.cpp
parent004f69b535764e237346b4257f6876b88dbb4405 (diff)
downloadserenity-20eb441cba5b01147f7ce0bc4127da4b99223ad1.zip
LibWeb: Evict replaced Resource objects from cache
When a Resource is converted to an ImageResource, evict the original resource from cache. The original resource's data has been moved, so on a warm reload of a page, when that resource is loaded from cache, it would not have any data to actually show.
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader/Resource.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Loader/Resource.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp
index d922546e88..6682756480 100644
--- a/Userland/Libraries/LibWeb/Loader/Resource.cpp
+++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp
@@ -11,6 +11,7 @@
#include <LibTextCodec/Decoder.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/Loader/Resource.h>
+#include <LibWeb/Loader/ResourceLoader.h>
namespace Web {
@@ -39,6 +40,7 @@ Resource::Resource(Type type, Resource& resource)
, m_response_headers(move(resource.m_response_headers))
, m_status_code(move(resource.m_status_code))
{
+ ResourceLoader::the().evict_from_cache(m_request);
}
Resource::~Resource() = default;