SessionHistoryEntry.cpp 886 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Crypto/Crypto.h>
  7. #include <LibWeb/HTML/BrowsingContext.h>
  8. #include <LibWeb/HTML/DocumentState.h>
  9. #include <LibWeb/HTML/SessionHistoryEntry.h>
  10. namespace Web::HTML {
  11. JS_DEFINE_ALLOCATOR(SessionHistoryEntry);
  12. void SessionHistoryEntry::visit_edges(Cell::Visitor& visitor)
  13. {
  14. Base::visit_edges(visitor);
  15. visitor.visit(document_state);
  16. visitor.visit(original_source_browsing_context);
  17. }
  18. SessionHistoryEntry::SessionHistoryEntry()
  19. : classic_history_api_state(MUST(structured_serialize_for_storage(vm(), JS::js_null())))
  20. , navigation_api_state(MUST(structured_serialize_for_storage(vm(), JS::js_undefined())))
  21. , navigation_api_key(MUST(Crypto::generate_random_uuid()))
  22. , navigation_api_id(MUST(Crypto::generate_random_uuid()))
  23. {
  24. }
  25. }