1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

LibWeb/HTML: Port Window.origin to IDL

This commit is contained in:
Linus Groh 2023-03-06 11:11:17 +00:00
parent 376fb9ae40
commit 188aac5077
3 changed files with 3 additions and 16 deletions

View file

@ -1102,7 +1102,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
define_native_accessor(realm, "localStorage", local_storage_getter, {}, attr);
define_native_accessor(realm, "sessionStorage", session_storage_getter, {}, attr);
define_native_accessor(realm, "origin", origin_getter, {}, attr);
define_native_accessor(realm, "isSecureContext", is_secure_context_getter, {}, attr);
// Legacy
@ -1118,11 +1117,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
return {};
}
HTML::Origin Window::origin() const
{
return associated_document().origin();
}
// https://webidl.spec.whatwg.org/#platform-object-setprototypeof
JS::ThrowCompletionOr<bool> Window::internal_set_prototype_of(JS::Object* prototype)
{
@ -1835,13 +1829,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::structured_clone)
}));
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-origin
JS_DEFINE_NATIVE_FUNCTION(Window::origin_getter)
{
auto* impl = TRY(impl_from(vm));
return JS::PrimitiveString::create(vm, impl->associated_document().origin().serialize());
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-issecurecontext
JS_DEFINE_NATIVE_FUNCTION(Window::is_secure_context_getter)
{

View file

@ -218,8 +218,6 @@ private:
Vector<JS::NonnullGCPtr<MimeType>> m_pdf_viewer_mime_type_objects;
public:
HTML::Origin origin() const;
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(JS::Object* prototype) override;
CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
@ -259,7 +257,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(local_storage_getter);
JS_DECLARE_NATIVE_FUNCTION(session_storage_getter);
JS_DECLARE_NATIVE_FUNCTION(origin_getter);
JS_DECLARE_NATIVE_FUNCTION(is_secure_context_getter);
JS_DECLARE_NATIVE_FUNCTION(set_interval);

View file

@ -35,6 +35,9 @@ interface Window : EventTarget {
undefined postMessage(any message, USVString targetOrigin);
// FIXME: undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
// FIXME: undefined postMessage(any message, optional WindowPostMessageOptions options = {});
// FIXME: Replace these with 'Window includes WindowOrWorkerGlobalScope;' once we have feature parity
[Replaceable] readonly attribute USVString origin;
};
Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;