LibWeb: Run the object representation task when the active state changes

Currently, the following JS snippet will hang indefinitely:

    new DOMParser().parseFromString("<object>", "text/html");

Because the document into which the object is inserted is not active. So
the task queued to run the representation steps will never run.

This patch implements the spec steps to rerun the representation steps
when the active state changes, and avoid the hang when the object is
created in an inactive document.
This commit is contained in:
Timothy Flynn 2024-12-11 13:18:21 -05:00 committed by Andrew Kaster
parent a2419b5f4e
commit 68164aa7ec
Notes: github-actions[bot] 2024-12-12 00:39:30 +00:00
5 changed files with 681 additions and 0 deletions

View file

@ -90,6 +90,8 @@ private:
GC::Ptr<SharedResourceRequest> m_resource_request;
GC::Ptr<DOM::DocumentObserver> m_document_observer;
Optional<DOM::DocumentLoadEventDelayer> m_document_load_event_delayer_for_object_representation_task;
Optional<DOM::DocumentLoadEventDelayer> m_document_load_event_delayer_for_resource_load;
};