History.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <LibJS/Heap/Handle.h>
  9. #include <LibWeb/Bindings/PlatformObject.h>
  10. #include <LibWeb/DOM/ExceptionOr.h>
  11. namespace Web::HTML {
  12. class History final : public Bindings::PlatformObject {
  13. WEB_PLATFORM_OBJECT(History, Bindings::PlatformObject);
  14. public:
  15. static JS::NonnullGCPtr<History> create(HTML::Window&, DOM::Document&);
  16. virtual ~History() override;
  17. DOM::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url);
  18. DOM::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
  19. private:
  20. explicit History(HTML::Window&, DOM::Document&);
  21. virtual void visit_edges(Cell::Visitor&) override;
  22. enum class IsPush {
  23. No,
  24. Yes,
  25. };
  26. DOM::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
  27. JS::NonnullGCPtr<DOM::Document> m_associated_document;
  28. };
  29. }
  30. WRAPPER_HACK(History, Web::HTML)