/* * Copyright (c) 2021, Luke Wilde * Copyright (c) 2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Web::HTML { class History final : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(History, Bindings::PlatformObject); public: static WebIDL::ExceptionOr> create(JS::Realm&, DOM::Document&); virtual ~History() override; WebIDL::ExceptionOr push_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url); WebIDL::ExceptionOr replace_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url); WebIDL::ExceptionOr go(long delta); WebIDL::ExceptionOr back(); WebIDL::ExceptionOr forward(); WebIDL::ExceptionOr length() const; private: History(JS::Realm&, DOM::Document&); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; enum class IsPush { No, Yes, }; WebIDL::ExceptionOr shared_history_push_replace_state(JS::Value data, DeprecatedString const& url, IsPush is_push); JS::NonnullGCPtr m_associated_document; }; }