LibWeb: Don't begin link element fetch until browsing-context connected

Note that "becomes browsing-context connected" is defined as:

> When the insertion steps are invoked with it as the argument and it is
> now browsing-context connected.

This fixes an issue where WPT editing tests would clone the entire DOM
thousands of times and re-fetch all the linked CSS files once per clone.
This commit is contained in:
Andreas Kling 2025-03-03 13:48:37 +01:00 committed by Andreas Kling
parent 6cb0f41c57
commit fe2b752083
Notes: github-actions[bot] 2025-03-03 13:50:23 +00:00

View file

@ -73,7 +73,8 @@ void HTMLLinkElement::inserted()
// The appropriate times to fetch and process this type of link are:
// - When the external resource link is created on a link element that is already browsing-context connected.
// - When the external resource link's link element becomes browsing-context connected.
fetch_and_process_linked_resource();
if (is_browsing_context_connected())
fetch_and_process_linked_resource();
}
// FIXME: Follow spec for fetching and processing these attributes as well