From d36e3af7bebbf4601aceab365a81ca931e58d27e Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 27 Sep 2021 14:59:42 +0100 Subject: [PATCH] LibWeb: Don't try to ad-block data: urls In some cases these can be several KiB or more in size, making checking very slow, and it doesn't make sense to filter them out anyway. This change speeds up loading pages with large data: urls, which previously took up to 1ms per byte to process. --- Userland/Libraries/LibWeb/Loader/ContentFilter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp index 5a33e09e24..5d1e1777fe 100644 --- a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp +++ b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp @@ -25,6 +25,9 @@ ContentFilter::~ContentFilter() bool ContentFilter::is_filtered(const AK::URL& url) const { + if (url.protocol() == "data") + return false; + auto url_string = url.to_string(); for (auto& pattern : m_patterns) {