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

LibWeb: Update the document "abort" algorithm for navigables

This commit is contained in:
Aliaksandr Kalenik 2022-12-16 23:32:07 +01:00 committed by Andreas Kling
parent ce9af96f78
commit 2c3bb26551

View file

@ -2732,17 +2732,19 @@ void Document::destroy()
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#abort-a-document // https://html.spec.whatwg.org/multipage/browsing-the-web.html#abort-a-document
void Document::abort() void Document::abort()
{ {
// 1. Abort the active documents of every child browsing context. // 1. Abort the active documents of each of document's descendant navigables.
// If this results in any of those Document objects having their salvageable state set to false, // If this results in any of those Document objects having their salvageable state set to false,
// then set document's salvageable state to false also. // then set document's salvageable state to false also.
if (browsing_context()) { for (auto navigable : descendant_navigables()) {
browsing_context()->for_each_child([this](HTML::BrowsingContext& child_browsing_context) { if (auto document = navigable->active_document()) {
if (auto* child_document = child_browsing_context.active_document()) { // NOTE: This is not in the spec but we need to abort ongoing navigations in all descendandt navigables.
child_document->abort(); // See https://github.com/whatwg/html/issues/9711
if (!child_document->m_salvageable) navigable->set_ongoing_navigation({});
m_salvageable = false;
} document->abort();
}); if (!document->m_salvageable)
m_salvageable = false;
}
} }
// FIXME: 2. Cancel any instances of the fetch algorithm in the context of document, // FIXME: 2. Cancel any instances of the fetch algorithm in the context of document,