/* * 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; DeprecatedString href() const; JS::ThrowCompletionOr set_href(DeprecatedString const&); DeprecatedString origin() const; DeprecatedString protocol() const; JS::ThrowCompletionOr set_protocol(DeprecatedString const&); DeprecatedString host() const; JS::ThrowCompletionOr set_host(DeprecatedString const&); DeprecatedString hostname() const; JS::ThrowCompletionOr set_hostname(DeprecatedString const&); DeprecatedString port() const; JS::ThrowCompletionOr set_port(DeprecatedString const&); DeprecatedString pathname() const; JS::ThrowCompletionOr set_pathname(DeprecatedString const&); DeprecatedString search() const; JS::ThrowCompletionOr set_search(DeprecatedString const&); DeprecatedString hash() const; JS::ThrowCompletionOr set_hash(DeprecatedString const&); void replace(DeprecatedString url) const; void reload() 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; DOM::Document const* 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; }; }