Skip to content

Truly independent web browser

LibWebView: Set ever populated where step 7 saves the document's state

Shannon Booth3548021fc1a0
diff --git a/Libraries/LibWebView/CanonicalNavigable.cpp b/Libraries/LibWebView/CanonicalNavigable.cpp
index 3f4e8917874..cbdf8afa032 100644
--- a/Libraries/LibWebView/CanonicalNavigable.cpp
+++ b/Libraries/LibWebView/CanonicalNavigable.cpp
@@ -1554,11 +1554,6 @@ void CanonicalNavigable::apply_populated_history_entry(CanonicalSessionHistoryEn
entry.classic_history_api_state = populated_entry.classic_history_api_state;
if (populated_entry.document_state.id == entry.document_state->id) {
entry.document_state->resource = populated_entry.document_state.resource;
- // https://html.spec.whatwg.org/multipage/browsing-the-web.html#populating-a-session-history-entry
- // 7.1. Set entry's document state's ever populated to true.
- // NB: The populated entry is the UI process's population request, which can't know that a document came of it.
- // The entry holds the document that was populated for it.
- entry.document_state->ever_populated = true;
return;
}
@@ -1572,8 +1567,6 @@ void CanonicalNavigable::apply_populated_history_entry(CanonicalSessionHistoryEn
document_state->populated_document = exchange(entry.document_state->populated_document, {});
if (m_document_state_populated_by_history_job == entry.document_state)
m_document_state_populated_by_history_job = document_state;
- // 7.1. Set entry's document state's ever populated to true.
- document_state->ever_populated = true;
entry.document_state = move(document_state);
}
@@ -1592,7 +1585,7 @@ void CanonicalNavigable::did_commit_navigation(CanonicalSessionHistoryEntry& ent
// The document populated for the entry becomes its document state's document below.
// NB: The process hosting the document ran the steps populating it for the entry it holds.
- entry.document_state->save_the_origin_of_the_populated_document();
+ entry.document_state->save_the_state_of_the_populated_document();
RefPtr<CanonicalDocument> document;
if (auto populated_document = exchange(entry.document_state->populated_document, {}); populated_document.has_value())
document = populated_document->document;
diff --git a/Libraries/LibWebView/CanonicalSessionHistoryEntry.cpp b/Libraries/LibWebView/CanonicalSessionHistoryEntry.cpp
index 3333c643a2f..c123327fbce 100644
--- a/Libraries/LibWebView/CanonicalSessionHistoryEntry.cpp
+++ b/Libraries/LibWebView/CanonicalSessionHistoryEntry.cpp
@@ -28,13 +28,16 @@ CanonicalDocumentState::CanonicalDocumentState(Web::HTML::CrossProcessId id)
CanonicalDocumentState::~CanonicalDocumentState() = default;
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document
-void CanonicalDocumentState::save_the_origin_of_the_populated_document()
+void CanonicalDocumentState::save_the_state_of_the_populated_document()
{
// 7. If entry's document state's document is not null, then:
if (!populated_document.has_value())
return;
auto const& document = *populated_document->document;
+ // 1. Set entry's document state's ever populated to true.
+ ever_populated = true;
+
// 2. If saveExtraDocumentState is true:
// NB: It is false for a document created for inline content in place of the response.
if (populated_document->inline_content_origin.has_value() && document.origin().is_same_origin(*populated_document->inline_content_origin))
diff --git a/Libraries/LibWebView/CanonicalSessionHistoryEntry.h b/Libraries/LibWebView/CanonicalSessionHistoryEntry.h
index ad1322464fd..ff6e6a041de 100644
--- a/Libraries/LibWebView/CanonicalSessionHistoryEntry.h
+++ b/Libraries/LibWebView/CanonicalSessionHistoryEntry.h
@@ -47,7 +47,7 @@ public:
~CanonicalDocumentState();
Web::HTML::SessionHistoryDocumentStateDescriptor descriptor() const;
- void save_the_origin_of_the_populated_document();
+ void save_the_state_of_the_populated_document();
// NB: The identity the processes hosting the document state's documents give it.
Web::HTML::CrossProcessId id;
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index 16c9bd94895..ae7408255cd 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -2126,7 +2126,7 @@ void CanonicalTraversable::did_attempt_to_populate_the_history_entry_document(We
&& navigation->history_entry->update_from_descriptor(history_entry_descriptor).is_error()) {
return;
}
- navigation->history_entry->document_state->save_the_origin_of_the_populated_document();
+ navigation->history_entry->document_state->save_the_state_of_the_populated_document();
return;
}