summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-10-13 22:25:08 +0200
committerLinus Groh <mail@linusgroh.de>2022-10-30 20:10:29 +0000
commit8db64a8704c862c6c34aeaa8029ab331c2e98262 (patch)
treebfc4f74d67654dbe4a613e6a5e36681caed18993 /Userland
parent4baf0a44864728441d9d52a2f1ce73b2d76745b8 (diff)
downloadserenity-8db64a8704c862c6c34aeaa8029ab331c2e98262.zip
LibWeb: Implement 'Is non-secure context' AO
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Environments.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
index ff5ee24a8a..4d3e9eccc1 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
@@ -423,4 +423,11 @@ bool is_secure_context(Environment const& environment)
return false;
}
+// https://html.spec.whatwg.org/multipage/webappapis.html#non-secure-context
+bool is_non_secure_context(Environment const& environment)
+{
+ // An environment is a non-secure context if it is not a secure context.
+ return !is_secure_context(environment);
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h
index c2690d91b5..ea19b05a62 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h
@@ -144,5 +144,6 @@ EnvironmentSettingsObject& relevant_settings_object(JS::Object const&);
EnvironmentSettingsObject& relevant_settings_object(DOM::Node const&);
JS::Object& relevant_global_object(JS::Object const&);
[[nodiscard]] bool is_secure_context(Environment const&);
+[[nodiscard]] bool is_non_secure_context(Environment const&);
}