History.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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, DeprecatedString const& unused, DeprecatedString const& url);
  17. WebIDL::ExceptionOr<void> replace_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url);
  18. WebIDL::ExceptionOr<void> go(long delta);
  19. WebIDL::ExceptionOr<void> back();
  20. WebIDL::ExceptionOr<void> forward();
  21. WebIDL::ExceptionOr<u64> length() const;
  22. private:
  23. History(JS::Realm&, DOM::Document&);
  24. virtual void visit_edges(Cell::Visitor&) override;
  25. enum class IsPush {
  26. No,
  27. Yes,
  28. };
  29. WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, DeprecatedString const& url, IsPush is_push);
  30. JS::NonnullGCPtr<DOM::Document> m_associated_document;
  31. };
  32. }