mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 00:13:02 +00:00
LibWeb: Skip HTMLLinkElement resource fetching for documents without BC
Fixes crashing after following steps: 1. Open https://github.com/SerenityOS/serenity 2. Click on "Pull requests" tab The problem was `navigable` null pointer dereferencing in `decode_favicon()`. But navigable is null because the document was created by `parseFromString()` DOMParser API. With this change we skip fetching initiated by HTMLLinkElement if document does not have a browsing context: - Favicon is not displayed for such documents so no need to fetch. - Stylesheets fetching won't affect such document because style or layout does not run for them.
This commit is contained in:
parent
4c921e17b7
commit
988c8451d4
Notes:
sideshowbarker
2024-07-17 16:23:06 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 988c8451d4
Pull-request: https://github.com/SerenityOS/serenity/pull/24101
Reviewed-by: https://github.com/awesomekling
4 changed files with 16 additions and 1 deletions
|
@ -59,6 +59,10 @@ void HTMLLinkElement::inserted()
|
|||
{
|
||||
HTMLElement::inserted();
|
||||
|
||||
if (!document().browsing_context()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_relationship & Relationship::Stylesheet) {
|
||||
// https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet:fetch-and-process-the-linked-resource
|
||||
// The appropriate times to fetch and process this type of link are:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue