diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp
index 1b84757f05..7f7bc17dcc 100644
--- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp
+++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Andrew Kaster
+ * Copyright (c) 2023, Linus Groh
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -104,10 +105,12 @@ ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-origin
-String WorkerGlobalScope::origin() const
+WebIDL::ExceptionOr WorkerGlobalScope::origin() const
{
- // FIXME: The origin getter steps are to return this's relevant settings object's origin, serialized.
- return {};
+ auto& vm = this->vm();
+
+ // The origin getter steps are to return this's relevant settings object's origin, serialized.
+ return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(relevant_settings_object(this_impl()).origin().serialize()));
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-issecurecontext
diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h
index 3beb9828aa..f266519718 100644
--- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h
+++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h
@@ -54,7 +54,7 @@ public:
// Following methods are from the WindowOrWorkerGlobalScope mixin
// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin
- String origin() const;
+ WebIDL::ExceptionOr origin() const;
bool is_secure_context() const;
bool cross_origin_isolated() const;
WebIDL::ExceptionOr btoa(String const& data) const;