summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-11 12:29:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-11 14:10:11 +0200
commit5c905acf1d82828799a1e5f85151e4bbec709c19 (patch)
tree8b40ee0d07ea52c64b7a5084f7ea3b8027c10095 /Userland
parent4acdea7cfee15eb6dce78afeb6762ef9b726f0f0 (diff)
downloadserenity-5c905acf1d82828799a1e5f85151e4bbec709c19.zip
LibWeb: Add naive support for the Document.referrer attribute
It always returns the empty string for now.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp6
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.h4
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.idl2
3 files changed, 11 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 68cb32f1de..5d6fac43de 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -964,4 +964,10 @@ bool Document::has_a_style_sheet_that_is_blocking_scripts() const
return browsing_context()->container_document()->m_script_blocking_style_sheet_counter > 0;
}
+String Document::referrer() const
+{
+ // FIXME: Return the document's actual referrer.
+ return "";
+}
+
}
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index 9c59f25fdb..b9dc5ca93f 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -58,6 +58,8 @@ public:
String cookie(Cookie::Source = Cookie::Source::NonHttp);
void set_cookie(String, Cookie::Source = Cookie::Source::NonHttp);
+ String referrer() const;
+
bool should_invalidate_styles_on_attribute_changes() const { return m_should_invalidate_styles_on_attribute_changes; }
void set_should_invalidate_styles_on_attribute_changes(bool b) { m_should_invalidate_styles_on_attribute_changes = b; }
diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl
index bf9fdafaac..d233575e68 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.idl
+++ b/Userland/Libraries/LibWeb/DOM/Document.idl
@@ -13,6 +13,8 @@ interface Document : Node {
attribute DOMString cookie;
+ readonly attribute USVString referrer;
+
Element? getElementById(DOMString id);
HTMLCollection getElementsByName(DOMString name);
HTMLCollection getElementsByTagName(DOMString tagName);