diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 651783c6ac..35e5caa8fd 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -509,16 +509,12 @@ ExceptionOr Document::close() HTML::Origin Document::origin() const { - if (!m_url.is_valid()) - return {}; - return { m_url.protocol(), m_url.host(), m_url.port_or_default() }; + return m_origin; } void Document::set_origin(HTML::Origin const& origin) { - m_url.set_protocol(origin.protocol()); - m_url.set_host(origin.host()); - m_url.set_port(origin.port()); + m_origin = origin; } void Document::schedule_style_update() diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index f71b88e13a..49edb13afa 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -482,6 +482,9 @@ private: // https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank bool m_is_initial_about_blank { false }; + + // https://dom.spec.whatwg.org/#concept-document-origin + HTML::Origin m_origin; }; }