History.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
  3. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/Bindings/PlatformObject.h>
  9. #include <LibWeb/WebIDL/ExceptionOr.h>
  10. namespace Web::HTML {
  11. class History final : public Bindings::PlatformObject {
  12. WEB_PLATFORM_OBJECT(History, Bindings::PlatformObject);
  13. public:
  14. static JS::NonnullGCPtr<History> create(JS::Realm&, DOM::Document&);
  15. virtual ~History() override;
  16. WebIDL::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url);
  17. WebIDL::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
  18. private:
  19. History(JS::Realm&, DOM::Document&);
  20. virtual void visit_edges(Cell::Visitor&) override;
  21. enum class IsPush {
  22. No,
  23. Yes,
  24. };
  25. WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
  26. JS::NonnullGCPtr<DOM::Document> m_associated_document;
  27. };
  28. }