LibWeb: Initialize document referrer from Fetch Request if available

This commit is contained in:
Andreas Kling 2022-09-20 10:48:10 +02:00
parent 9683da4470
commit 77d947b8ad
Notes: sideshowbarker 2024-07-17 06:49:04 +09:00

View File

@ -243,9 +243,16 @@ JS::NonnullGCPtr<Document> Document::create_and_initialize(Type type, String con
// 12. If navigationParams's request is non-null, then:
if (navigation_params.request) {
// FIXME: 1. Set document's referrer to the empty string.
// FIXME: 2. Let referrer be navigationParams's request's referrer.
// FIXME: 3. If referrer is a URL record, then set document's referrer to the serialization of referrer.
// 1. Set document's referrer to the empty string.
document->m_referrer = String::empty();
// 2. Let referrer be navigationParams's request's referrer.
auto& referrer = navigation_params.request->referrer();
// 3. If referrer is a URL record, then set document's referrer to the serialization of referrer.
if (referrer.has<AK::URL>()) {
document->m_referrer = referrer.get<AK::URL>().serialize();
}
}
// FIXME: 13. Let historyHandling be navigationParams's history handling.