LibWeb: Catch up with the spec on document destroy, abort and unload

These changes do not solve hanging `location.reload()` and
`location.go()` but only align implementation with the latest edits in
the specification.

`WindowProxy-Get-after-detaching-from-browsing-context` test output is
affected because `iframe.remove();` no longer synchronously does
destruction of a document, but queues a task on event loop.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
This commit is contained in:
Aliaksandr Kalenik 2024-03-31 23:42:51 +02:00 committed by Alexander Kalenik
commit 9098fa23a2
Notes: sideshowbarker 2024-07-17 00:16:31 +09:00
6 changed files with 207 additions and 81 deletions

View file

@ -489,13 +489,20 @@ public:
Vector<JS::Handle<HTML::Navigable>> inclusive_ancestor_navigables();
Vector<JS::Handle<HTML::Navigable>> document_tree_child_navigables();
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#destroy-a-document
void destroy();
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#destroy-a-document-and-its-descendants
void destroy_a_document_and_its_descendants(JS::SafeFunction<void()> after_all_destruction = {});
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#abort-a-document
void abort();
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#abort-a-document-and-its-descendants
void abort_a_document_and_its_descendants();
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#unload-a-document
void unload(JS::GCPtr<Document> new_document = nullptr);
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#unload-a-document-and-its-descendants
void unload_a_document_and_its_descendants(JS::GCPtr<Document> new_document, JS::SafeFunction<void()> after_all_unloads = {});
// https://html.spec.whatwg.org/multipage/dom.html#active-parser
JS::GCPtr<HTML::HTMLParser> active_parser();