mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
LibWeb: Store document origin as a HTML::Origin object
This will allow us to remember an arbitrary origin instead of deriving it from the document's URL.
This commit is contained in:
parent
130be479cb
commit
6e71e400e6
2 changed files with 5 additions and 6 deletions
|
@ -509,16 +509,12 @@ ExceptionOr<void> Document::close()
|
||||||
|
|
||||||
HTML::Origin Document::origin() const
|
HTML::Origin Document::origin() const
|
||||||
{
|
{
|
||||||
if (!m_url.is_valid())
|
return m_origin;
|
||||||
return {};
|
|
||||||
return { m_url.protocol(), m_url.host(), m_url.port_or_default() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::set_origin(HTML::Origin const& origin)
|
void Document::set_origin(HTML::Origin const& origin)
|
||||||
{
|
{
|
||||||
m_url.set_protocol(origin.protocol());
|
m_origin = origin;
|
||||||
m_url.set_host(origin.host());
|
|
||||||
m_url.set_port(origin.port());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::schedule_style_update()
|
void Document::schedule_style_update()
|
||||||
|
|
|
@ -482,6 +482,9 @@ private:
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
||||||
bool m_is_initial_about_blank { false };
|
bool m_is_initial_about_blank { false };
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#concept-document-origin
|
||||||
|
HTML::Origin m_origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue