summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-05-13 11:45:21 +0100
committerLinus Groh <mail@linusgroh.de>2022-05-13 16:25:33 +0200
commit1f82beded3ae3664265f1ddf6075f64ca5a08cde (patch)
treebf6a49885ababf87168f403e3832943b3f7ccd6a /Userland/Libraries/LibWeb
parent61a9ad45ed263d745bb35714ee22f3955590f335 (diff)
downloadserenity-1f82beded3ae3664265f1ddf6075f64ca5a08cde.zip
LibWeb: Make about:blank load correctly
- Don't treat an empty `about:blank` resource as an error. - Give `about:` urls a content-type so `FrameLoader::parse_document()` won't reject them.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
index 73d5a17132..94b3aa9b03 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -331,7 +331,7 @@ void FrameLoader::resource_did_load()
}
m_redirects_count = 0;
- if (!resource()->has_encoded_data()) {
+ if (!resource()->has_encoded_data() && url.to_string() != "about:blank") {
load_error_page(url, "No data");
return;
}
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
index d4d1179b03..e45ae44d27 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -150,8 +150,12 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has
if (url.protocol() == "about") {
dbgln_if(SPAM_DEBUG, "Loading about: URL {}", url);
log_success(request);
- deferred_invoke([success_callback = move(success_callback)] {
- success_callback(String::empty().to_byte_buffer(), {}, {});
+
+ HashMap<String, String, CaseInsensitiveStringTraits> response_headers;
+ response_headers.set("Content-Type", "text/html; charset=UTF-8");
+
+ deferred_invoke([success_callback = move(success_callback), response_headers = move(response_headers)] {
+ success_callback(String::empty().to_byte_buffer(), response_headers, {});
});
return;
}