mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibWeb: Add response status check when loading fallback favicon
If a favicon image response status was not ok, we would still attempt to decode the received body data.
This commit is contained in:
parent
8085e3eb26
commit
7f04ceb4f6
Notes:
sideshowbarker
2024-07-17 05:01:20 +09:00
Author: https://github.com/rmg-x Commit: https://github.com/LadybirdBrowser/ladybird/commit/7f04ceb4f6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/464 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 5 additions and 0 deletions
|
@ -584,6 +584,11 @@ WebIDL::ExceptionOr<void> HTMLLinkElement::load_fallback_favicon_if_needed(JS::N
|
|||
auto process_body_error = JS::create_heap_function(realm.heap(), [](JS::Value) {
|
||||
});
|
||||
|
||||
// Check for failed favicon response
|
||||
if (!Fetch::Infrastructure::is_ok_status(response->status()) || !response->body()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Use response's unsafe response as an icon as if it had been declared using the icon keyword.
|
||||
if (auto body = response->unsafe_response()->body())
|
||||
body->fully_read(realm, process_body, process_body_error, global);
|
||||
|
|
Loading…
Reference in a new issue