summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-20 10:48:10 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-20 14:48:07 +0200
commit77d947b8ad623b6b1329ca8edb1ad457e699ee40 (patch)
tree2dbd3fc1422b6ad2c0c30fcfbe7c72801f2282da /Userland
parent9683da4470e6642f60ca5ec2586564f9a48f9f22 (diff)
downloadserenity-77d947b8ad623b6b1329ca8edb1ad457e699ee40.zip
LibWeb: Initialize document referrer from Fetch Request if available
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 8397ef9e93..5ba5e43dfa 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -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.