1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +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:
Andreas Kling 2020-09-22 18:24:49 +02:00
parent 618dcbe405
commit b4a3537716
2 changed files with 8 additions and 0 deletions

View file

@ -44,6 +44,7 @@
#include <LibWeb/Bindings/XMLHttpRequestPrototype.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Origin.h>
namespace Web {
namespace Bindings {
@ -93,6 +94,11 @@ void WindowObject::visit_children(Visitor& visitor)
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)
{
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);