1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibWeb: Pass optional status code to ResourceLoader callbacks

This is needed for XMLHttpRequest, and will certainly be useful for
other things, too.
This commit is contained in:
Linus Groh 2021-04-03 15:11:36 +02:00 committed by Andreas Kling
parent 975b209b9b
commit 000ef96613
8 changed files with 42 additions and 39 deletions

View file

@ -178,7 +178,7 @@ bool FrameLoader::load(const LoadRequest& request, Type type)
ResourceLoader::the().load(
favicon_url,
[this, favicon_url](auto data, auto&) {
[this, favicon_url](auto data, auto&, auto) {
dbgln("Favicon downloaded, {} bytes from {}", data.size(), favicon_url);
auto decoder = Gfx::ImageDecoder::create(data.data(), data.size());
auto bitmap = decoder->bitmap();
@ -226,7 +226,7 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error)
auto error_page_url = "file:///res/html/error.html";
ResourceLoader::the().load(
error_page_url,
[this, failed_url, error](auto data, auto&) {
[this, failed_url, error](auto data, auto&, auto) {
VERIFY(!data.is_null());
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
auto html = String::format(
@ -238,7 +238,7 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error)
VERIFY(document);
frame().set_document(document);
},
[](auto error) {
[](auto& error, auto) {
dbgln("Failed to load error page: {}", error);
VERIFY_NOT_REACHED();
});