1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

LibWeb: Implement loading a favicon in absence of a <link> icon element

For example, serenityos.org does not contain a <link rel="icon"> element
to indicate its favicon. Before navigables, we implemented attempting to
load a fallback favicon in a rather ad-hoc manner. This implements the
full spec steps to do so after the HTML document is parsed.
This commit is contained in:
Timothy Flynn 2023-10-30 10:47:34 -04:00 committed by Andreas Kling
parent b1274a885b
commit 19313945f2
3 changed files with 62 additions and 15 deletions

View file

@ -1887,6 +1887,8 @@ void Document::update_readiness(HTML::DocumentReadyState readiness_value)
dispatch_event(Event::create(realm(), HTML::EventNames::readystatechange));
if (readiness_value == HTML::DocumentReadyState::Complete && is_active() && navigable()->is_traversable()) {
HTML::HTMLLinkElement::load_fallback_favicon_if_needed(*this).release_value_but_fixme_should_propagate_errors();
if (auto* page = navigable()->traversable_navigable()->page()) {
page->client().page_did_finish_loading(url());
}