mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
LibWeb: Add fields to SessionHistoryEntry required by Navigation API
This commit is contained in:
parent
cf0ffc12cc
commit
6856634ebc
2 changed files with 28 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibWeb/Crypto/Crypto.h>
|
||||||
#include <LibWeb/HTML/BrowsingContext.h>
|
#include <LibWeb/HTML/BrowsingContext.h>
|
||||||
#include <LibWeb/HTML/DocumentState.h>
|
#include <LibWeb/HTML/DocumentState.h>
|
||||||
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
||||||
|
@ -17,4 +18,12 @@ void SessionHistoryEntry::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(original_source_browsing_context);
|
visitor.visit(original_source_browsing_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SessionHistoryEntry::SessionHistoryEntry()
|
||||||
|
: classic_history_api_state(MUST(structured_serialize_for_storage(vm(), JS::js_null())))
|
||||||
|
, navigation_api_state(MUST(structured_serialize_for_storage(vm(), JS::js_undefined())))
|
||||||
|
, navigation_api_key(MUST(Crypto::generate_random_uuid()))
|
||||||
|
, navigation_api_id(MUST(Crypto::generate_random_uuid()))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <LibJS/Heap/GCPtr.h>
|
#include <LibJS/Heap/GCPtr.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/PolicyContainers.h>
|
#include <LibWeb/HTML/PolicyContainers.h>
|
||||||
|
#include <LibWeb/HTML/StructuredSerialize.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -30,6 +31,8 @@ enum class ScrollRestorationMode {
|
||||||
struct SessionHistoryEntry final : public JS::Cell {
|
struct SessionHistoryEntry final : public JS::Cell {
|
||||||
JS_CELL(SessionHistoryEntry, JS::Cell);
|
JS_CELL(SessionHistoryEntry, JS::Cell);
|
||||||
|
|
||||||
|
SessionHistoryEntry();
|
||||||
|
|
||||||
void visit_edges(Cell::Visitor&) override;
|
void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
enum class Pending {
|
enum class Pending {
|
||||||
|
@ -50,6 +53,22 @@ struct SessionHistoryEntry final : public JS::Cell {
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-document-state
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-document-state
|
||||||
JS::GCPtr<HTML::DocumentState> document_state;
|
JS::GCPtr<HTML::DocumentState> document_state;
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-classic-history-api-state
|
||||||
|
// classic history API state, which is serialized state, initially StructuredSerializeForStorage(null).
|
||||||
|
SerializationRecord classic_history_api_state;
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-navigation-api-state
|
||||||
|
// navigation API state, which is a serialized state, initially StructuredSerializeForStorage(undefined).
|
||||||
|
SerializationRecord navigation_api_state;
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-navigation-api-key
|
||||||
|
// navigation API key, which is a string, initially set to the result of generating a random UUID.
|
||||||
|
String navigation_api_key;
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-navigation-api-id
|
||||||
|
// navigation API ID, which is a string, initially set to the result of generating a random UUID.
|
||||||
|
String navigation_api_id;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-scroll-restoration-mode
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-scroll-restoration-mode
|
||||||
// scroll restoration mode, a scroll restoration mode, initially "auto"
|
// scroll restoration mode, a scroll restoration mode, initially "auto"
|
||||||
ScrollRestorationMode scroll_restoration_mode { ScrollRestorationMode::Auto };
|
ScrollRestorationMode scroll_restoration_mode { ScrollRestorationMode::Auto };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue