LibWeb: Do not return an exception from fetching CSS resources

The exception returned here is never used or logged. Let's just return
a null request, to make it clearer that these are not exceptions shown
to the user (thus not observable).
This commit is contained in:
Timothy Flynn 2025-11-12 11:47:27 -05:00 committed by Jelle Raaijmakers
parent 2811c75031
commit d8ec204be8
Notes: github-actions[bot] 2025-11-12 17:32:01 +00:00
3 changed files with 13 additions and 14 deletions

View file

@ -265,7 +265,7 @@ void FontLoader::start_loading_next_url()
// CSS style sheet, destination "font", CORS mode "cors", and processResponse being the following steps given
// response res and null, failure or a byte stream stream:
auto style_sheet_or_document = m_parent_style_sheet ? StyleSheetOrDocument { *m_parent_style_sheet } : StyleSheetOrDocument { m_style_computer->document() };
auto maybe_fetch_controller = fetch_a_style_resource(m_urls.take_first(), style_sheet_or_document, Fetch::Infrastructure::Request::Destination::Font, CorsMode::Cors,
m_fetch_controller = fetch_a_style_resource(m_urls.take_first(), style_sheet_or_document, Fetch::Infrastructure::Request::Destination::Font, CorsMode::Cors,
[loader = this](auto response, auto stream) {
// 1. If stream is null, return.
// 2. Load a font from stream according to its type.
@ -290,11 +290,8 @@ void FontLoader::start_loading_next_url()
}
});
if (maybe_fetch_controller.is_error()) {
if (!m_fetch_controller)
font_did_load_or_fail(nullptr);
} else {
m_fetch_controller = maybe_fetch_controller.release_value();
}
}
void FontLoader::font_did_load_or_fail(RefPtr<Gfx::Typeface const> typeface)