mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
LibWeb: Add WindowObject::origin()
This is a convenience getter to retrieve the security origin of a DOM window's document.
This commit is contained in:
parent
618dcbe405
commit
b4a3537716
2 changed files with 8 additions and 0 deletions
|
@ -44,6 +44,7 @@
|
||||||
#include <LibWeb/Bindings/XMLHttpRequestPrototype.h>
|
#include <LibWeb/Bindings/XMLHttpRequestPrototype.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/Window.h>
|
#include <LibWeb/DOM/Window.h>
|
||||||
|
#include <LibWeb/Origin.h>
|
||||||
|
|
||||||
namespace Web {
|
namespace Web {
|
||||||
namespace Bindings {
|
namespace Bindings {
|
||||||
|
@ -93,6 +94,11 @@ void WindowObject::visit_children(Visitor& visitor)
|
||||||
visitor.visit(m_xhr_prototype);
|
visitor.visit(m_xhr_prototype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Origin WindowObject::origin() const
|
||||||
|
{
|
||||||
|
return impl().document().origin();
|
||||||
|
}
|
||||||
|
|
||||||
static DOM::Window* impl_from(JS::Interpreter& interpreter, JS::GlobalObject& global_object)
|
static DOM::Window* impl_from(JS::Interpreter& interpreter, JS::GlobalObject& global_object)
|
||||||
{
|
{
|
||||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||||
|
|
|
@ -44,6 +44,8 @@ public:
|
||||||
DOM::Window& impl() { return *m_impl; }
|
DOM::Window& impl() { return *m_impl; }
|
||||||
const DOM::Window& impl() const { return *m_impl; }
|
const DOM::Window& impl() const { return *m_impl; }
|
||||||
|
|
||||||
|
Origin origin() const;
|
||||||
|
|
||||||
XMLHttpRequestPrototype* xhr_prototype() { return m_xhr_prototype; }
|
XMLHttpRequestPrototype* xhr_prototype() { return m_xhr_prototype; }
|
||||||
XMLHttpRequestConstructor* xhr_constructor() { return m_xhr_constructor; }
|
XMLHttpRequestConstructor* xhr_constructor() { return m_xhr_constructor; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue