/* * Copyright (c) 2020, Andreas Kling * Copyright (c) 2022-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::HTML { class Location final : public Bindings::PlatformObject { JS_OBJECT(Location, Bindings::PlatformObject); public: virtual ~Location() override; WebIDL::ExceptionOr href() const; WebIDL::ExceptionOr set_href(String const&); WebIDL::ExceptionOr origin() const; WebIDL::ExceptionOr protocol() const; WebIDL::ExceptionOr set_protocol(String const&); WebIDL::ExceptionOr host() const; WebIDL::ExceptionOr set_host(String const&); WebIDL::ExceptionOr hostname() const; WebIDL::ExceptionOr set_hostname(String const&); WebIDL::ExceptionOr port() const; WebIDL::ExceptionOr set_port(String const&); WebIDL::ExceptionOr pathname() const; WebIDL::ExceptionOr set_pathname(String const&); WebIDL::ExceptionOr search() const; WebIDL::ExceptionOr set_search(String const&); WebIDL::ExceptionOr hash() const; WebIDL::ExceptionOr set_hash(String const&); void replace(String const& url) const; void reload() const; WebIDL::ExceptionOr assign(String const& url) const; virtual JS::ThrowCompletionOr internal_get_prototype_of() const override; virtual JS::ThrowCompletionOr internal_set_prototype_of(Object* prototype) override; virtual JS::ThrowCompletionOr internal_is_extensible() const override; virtual JS::ThrowCompletionOr internal_prevent_extensions() override; virtual JS::ThrowCompletionOr> internal_get_own_property(JS::PropertyKey const&) const override; virtual JS::ThrowCompletionOr internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&) override; virtual JS::ThrowCompletionOr internal_get(JS::PropertyKey const&, JS::Value receiver) const override; virtual JS::ThrowCompletionOr internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; virtual JS::ThrowCompletionOr internal_delete(JS::PropertyKey const&) override; virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; HTML::CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; } HTML::CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; } private: explicit Location(JS::Realm&); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr relevant_document() const; AK::URL url() const; // [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap HTML::CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map; // [[DefaultProperties]], https://html.spec.whatwg.org/multipage/history.html#defaultproperties Vector m_default_properties; }; }