diff --git a/Tests/LibWeb/Text/expected/HTML/shadow-realm-async-evaluate.txt b/Tests/LibWeb/Text/expected/HTML/shadow-realm-async-evaluate.txt
new file mode 100644
index 00000000000..495cc9e1719
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/HTML/shadow-realm-async-evaluate.txt
@@ -0,0 +1 @@
+PASS: Exception thrown 'TypeError: Wrapped value must be primitive or a function object, got [object Promise]'
diff --git a/Tests/LibWeb/Text/expected/HTML/shadow-realm-sync-evaluate.txt b/Tests/LibWeb/Text/expected/HTML/shadow-realm-sync-evaluate.txt
new file mode 100644
index 00000000000..3b0b39fe9bd
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/HTML/shadow-realm-sync-evaluate.txt
@@ -0,0 +1 @@
+Shadow realm evaluation returned: 2
diff --git a/Tests/LibWeb/Text/input/HTML/shadow-realm-async-evaluate.html b/Tests/LibWeb/Text/input/HTML/shadow-realm-async-evaluate.html
new file mode 100644
index 00000000000..46e92a937c4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/HTML/shadow-realm-async-evaluate.html
@@ -0,0 +1,13 @@
+
+
diff --git a/Tests/LibWeb/Text/input/HTML/shadow-realm-sync-evaluate.html b/Tests/LibWeb/Text/input/HTML/shadow-realm-sync-evaluate.html
new file mode 100644
index 00000000000..a1cf3f1fa3d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/HTML/shadow-realm-sync-evaluate.html
@@ -0,0 +1,8 @@
+
+
diff --git a/Userland/Libraries/LibJS/Runtime/Realm.h b/Userland/Libraries/LibJS/Runtime/Realm.h
index a47eff87519..d09c5cfc30b 100644
--- a/Userland/Libraries/LibJS/Runtime/Realm.h
+++ b/Userland/Libraries/LibJS/Runtime/Realm.h
@@ -34,7 +34,10 @@ public:
static ThrowCompletionOr> initialize_host_defined_realm(VM&, Function