2020-05-18 21:42:40 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
2023-01-18 17:41:12 +00:00
|
|
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
2020-05-18 21:42:40 +02:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-05-18 21:42:40 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-03-06 00:24:18 +01:00
|
|
|
#include <LibJS/Forward.h>
|
2021-09-28 23:54:42 +01:00
|
|
|
#include <LibJS/Runtime/Completion.h>
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <LibURL/URL.h>
|
2022-09-04 16:55:50 +02:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2020-05-18 21:42:40 +02:00
|
|
|
#include <LibWeb/Forward.h>
|
2022-09-24 14:02:47 +01:00
|
|
|
#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
|
2024-03-28 12:58:43 +01:00
|
|
|
#include <LibWeb/HTML/Navigable.h>
|
2020-05-18 21:42:40 +02:00
|
|
|
|
2023-01-18 17:41:12 +00:00
|
|
|
namespace Web::HTML {
|
2020-05-18 21:42:40 +02:00
|
|
|
|
2023-01-18 17:41:12 +00:00
|
|
|
class Location final : public Bindings::PlatformObject {
|
2024-05-19 13:48:52 -07:00
|
|
|
WEB_PLATFORM_OBJECT(Location, Bindings::PlatformObject);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(Location);
|
2020-06-21 15:14:02 +02:00
|
|
|
|
2020-05-18 21:42:40 +02:00
|
|
|
public:
|
2023-01-18 17:41:12 +00:00
|
|
|
virtual ~Location() override;
|
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> href() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_href(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> origin() const;
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> protocol() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_protocol(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> host() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_host(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> hostname() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_hostname(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> port() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_port(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> pathname() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_pathname(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> search() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_search(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-03-04 22:16:07 +00:00
|
|
|
WebIDL::ExceptionOr<String> hash() const;
|
2023-03-04 22:19:14 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_hash(String const&);
|
2023-01-18 17:41:12 +00:00
|
|
|
|
2023-08-22 18:49:28 +02:00
|
|
|
WebIDL::ExceptionOr<void> replace(String const& url);
|
2023-01-18 17:41:12 +00:00
|
|
|
void reload() const;
|
2023-08-22 18:33:20 +02:00
|
|
|
WebIDL::ExceptionOr<void> assign(String const& url);
|
2020-05-18 21:42:40 +02:00
|
|
|
|
2022-03-06 00:24:18 +01:00
|
|
|
virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override;
|
2021-09-28 23:54:42 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
|
2021-09-29 00:02:05 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_is_extensible() const override;
|
2021-09-29 00:13:41 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override;
|
2022-03-06 00:24:18 +01:00
|
|
|
virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const&) const override;
|
2024-11-01 21:03:18 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&, Optional<JS::PropertyDescriptor>* precomputed_get_own_property = nullptr) override;
|
2024-05-02 11:13:08 +02:00
|
|
|
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const override;
|
2023-11-08 20:51:26 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*) override;
|
2022-03-06 00:24:18 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
|
2024-12-26 14:32:52 +01:00
|
|
|
virtual JS::ThrowCompletionOr<GC::RootVector<JS::Value>> internal_own_property_keys() const override;
|
2021-09-12 14:54:17 +01:00
|
|
|
|
2022-09-24 14:02:47 +01:00
|
|
|
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; }
|
2022-03-05 21:31:31 +01:00
|
|
|
|
2020-05-18 21:42:40 +02:00
|
|
|
private:
|
2023-01-18 17:41:12 +00:00
|
|
|
explicit Location(JS::Realm&);
|
2022-09-04 16:55:50 +02:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-09-04 16:55:50 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<DOM::Document> relevant_document() const;
|
2024-03-18 16:22:27 +13:00
|
|
|
URL::URL url() const;
|
2024-03-28 12:58:43 +01:00
|
|
|
WebIDL::ExceptionOr<void> navigate(URL::URL, Bindings::NavigationHistoryBehavior = Bindings::NavigationHistoryBehavior::Auto);
|
2022-03-05 00:15:36 +01:00
|
|
|
|
2022-03-05 21:31:31 +01:00
|
|
|
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
|
2022-09-24 14:02:47 +01:00
|
|
|
HTML::CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
|
2022-03-06 00:24:18 +01:00
|
|
|
|
|
|
|
// [[DefaultProperties]], https://html.spec.whatwg.org/multipage/history.html#defaultproperties
|
2022-09-04 16:55:50 +02:00
|
|
|
Vector<JS::Value> m_default_properties;
|
2020-05-18 21:42:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|