2020-05-18 21:42:40 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.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-05 00:17:47 +01:00
|
|
|
#include <AK/URL.h>
|
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>
|
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>
|
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 {
|
|
|
|
JS_OBJECT(Location, Bindings::PlatformObject);
|
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-03-04 22:16:07 +00:00
|
|
|
void replace(String const& url) const;
|
2023-01-18 17:41:12 +00:00
|
|
|
void reload() const;
|
2023-05-15 20:11:38 +01:00
|
|
|
WebIDL::ExceptionOr<void> assign(String const& url) const;
|
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;
|
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&) override;
|
2023-07-08 17:39:18 +02:00
|
|
|
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*) const override;
|
2022-03-06 00:24:18 +01:00
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
|
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
|
|
|
|
virtual JS::ThrowCompletionOr<JS::MarkedVector<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-01-28 12:33:35 -05:00
|
|
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
2022-09-04 16:55:50 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2023-03-04 22:37:12 +00:00
|
|
|
JS::GCPtr<DOM::Document> relevant_document() const;
|
2022-03-05 00:17:47 +01:00
|
|
|
AK::URL url() const;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|