summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Scripting
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Scripting')
-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 605ffb8f27..a5a3d41bf6 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
@@ -435,6 +435,13 @@ JS::Object& entry_global_object()
return entry_realm().global_object();
}
+JS::VM& relevant_agent(JS::Object const& object)
+{
+ // The relevant agent for a platform object platformObject is platformObject's relevant Realm's agent.
+ // Spec Note: This pointer is not yet defined in the JavaScript specification; see tc39/ecma262#1357.
+ return relevant_realm(object).vm();
+}
+
// https://html.spec.whatwg.org/multipage/webappapis.html#secure-context
bool is_secure_context(Environment const& environment)
{
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h
index 3bccf5ef08..d2a7bec305 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h
@@ -148,6 +148,7 @@ JS::Object& relevant_global_object(JS::Object const&);
JS::Realm& entry_realm();
EnvironmentSettingsObject& entry_settings_object();
JS::Object& entry_global_object();
+JS::VM& relevant_agent(JS::Object const&);
[[nodiscard]] bool is_secure_context(Environment const&);
[[nodiscard]] bool is_non_secure_context(Environment const&);