From cbe4ba7f8c825d9732346964c8f1f1f8eec00eac Mon Sep 17 00:00:00 2001 From: Edwin Hoksberg Date: Fri, 4 Oct 2024 18:23:11 +0200 Subject: [PATCH] LibWeb: Handle Refresh header Fixes a bunch of tests in: - https://staging.wpt.fyi/results/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh --- Userland/Libraries/LibWeb/DOM/Document.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 40105269f7d..64f55c00fd6 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -339,7 +339,14 @@ WebIDL::ExceptionOr> Document::create_and_initialize( // FIXME: 15. Create the navigation timing entry for document, with navigationParams's response's timing info, redirectCount, navigationParams's navigation timing type, and // navigationParams's response's service worker timing info. - // FIXME: 16. If navigationParams's response has a `Refresh` header, then: + // 16. If navigationParams's response has a `Refresh` header, then: + if (auto maybe_refresh = navigation_params.response->header_list()->get("Refresh"sv.bytes()); maybe_refresh.has_value()) { + // 1. Let value be the isomorphic decoding of the value of the header. + auto const& value = maybe_refresh.value(); + + // 2. Run the shared declarative refresh steps with document and value. + document->shared_declarative_refresh_steps(value, nullptr); + } // FIXME: 17. If navigationParams's commit early hints is not null, then call navigationParams's commit early hints with document.