Sfoglia il codice sorgente

LibWeb: Ignore preconnect requests for file: and data: URLs

I noticed while debugging a fully downloaded page that it was trying
to preconnect to a file:// host. That doesn't make any sense, so let's
add a tiny bit of logic to ignore preconnect requests for file: and
data: URLs.
Andreas Kling 1 anno fa
parent
commit
bf5ad56085
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp

+ 3 - 0
Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp

@@ -77,6 +77,9 @@ void ResourceLoader::prefetch_dns(AK::URL const& url)
 
 
 void ResourceLoader::preconnect(AK::URL const& url)
 void ResourceLoader::preconnect(AK::URL const& url)
 {
 {
+    if (url.scheme().is_one_of("file"sv, "data"sv))
+        return;
+
     if (ContentFilter::the().is_filtered(url)) {
     if (ContentFilter::the().is_filtered(url)) {
         dbgln("ResourceLoader: Refusing to pre-connect to '{}': \033[31;1mURL was filtered\033[0m", url);
         dbgln("ResourceLoader: Refusing to pre-connect to '{}': \033[31;1mURL was filtered\033[0m", url);
         return;
         return;