Skip to content

Truly independent web browser

LibWeb+LibWebView: Replicate the opener policy the UI process holds

Shannon Booth41cca1664e05
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index 629e0aa412b..74f463379b8 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -1521,7 +1521,6 @@ HostedNavigableState LocalNavigable::hosted_state() const
return {
.active_document_url = m_active_document->url(),
.active_document_is_fully_active = m_active_document->is_fully_active(),
- .opener_policy = m_active_document->opener_policy(),
.is_closing = m_closing,
.container = container_state(),
.delays_the_load_event_of_its_container = delays_the_load_event_of_its_container(),
diff --git a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp
index b9317baa670..88c0ea1e2ae 100644
--- a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp
+++ b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp
@@ -39,7 +39,6 @@ ErrorOr<void> encode(Encoder& encoder, Web::HTML::HostedNavigableState const& st
{
TRY(encoder.encode(state.active_document_url));
TRY(encoder.encode(state.active_document_is_fully_active));
- TRY(encoder.encode(state.opener_policy));
TRY(encoder.encode(state.is_closing));
TRY(encoder.encode(state.container));
TRY(encoder.encode(state.delays_the_load_event_of_its_container));
@@ -53,7 +52,6 @@ ErrorOr<Web::HTML::HostedNavigableState> decode(Decoder& decoder)
return Web::HTML::HostedNavigableState {
.active_document_url = TRY(decoder.decode<URL::URL>()),
.active_document_is_fully_active = TRY(decoder.decode<bool>()),
- .opener_policy = TRY(decoder.decode<Web::HTML::OpenerPolicy>()),
.is_closing = TRY(decoder.decode<bool>()),
.container = TRY(decoder.decode<Web::HTML::ReplicatedContainerState>()),
.delays_the_load_event_of_its_container = TRY(decoder.decode<bool>()),
diff --git a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h
index f34ae6f7e1d..0bc638dbece 100644
--- a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h
+++ b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h
@@ -44,7 +44,6 @@ struct ReplicatedContainerState {
struct HostedNavigableState {
URL::URL active_document_url;
bool active_document_is_fully_active { false };
- OpenerPolicy opener_policy;
bool is_closing { false };
ReplicatedContainerState container;
bool delays_the_load_event_of_its_container { false };
diff --git a/Libraries/LibWebView/CanonicalNavigable.cpp b/Libraries/LibWebView/CanonicalNavigable.cpp
index a9d9733da32..43d139a303a 100644
--- a/Libraries/LibWebView/CanonicalNavigable.cpp
+++ b/Libraries/LibWebView/CanonicalNavigable.cpp
@@ -1098,7 +1098,7 @@ Optional<Web::HTML::ReplicatedNavigableState> CanonicalNavigable::replicated_sta
.top_level_origin = traversable.active_document().origin(),
.has_cross_site_ancestor = active_document_has_cross_site_ancestor(),
.browsing_context_group_id = browsing_context_group_id,
- .opener_policy = hosted_state.opener_policy,
+ .opener_policy = active_document().opener_policy(),
.active_browsing_context_is_auxiliary = browsing_context.is_auxiliary(),
.opener_navigable_id = opener_navigable_id,
.active_document_is_completely_loaded = active_document().is_completely_loaded(),
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index 3d03c1a3e3a..387d7bb5154 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -763,7 +763,6 @@ CanonicalTraversable& CanonicalTraversable::create_a_new_top_level_traversable(W
traversable->set_hosted_state({
.active_document_url = initial_history_entry.url,
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = {},
.delays_the_load_event_of_its_container = false,
diff --git a/Tests/LibWebView/TestCanonicalBrowsingContextGroup.cpp b/Tests/LibWebView/TestCanonicalBrowsingContextGroup.cpp
index 6da54b86243..0b5b976ed74 100644
--- a/Tests/LibWebView/TestCanonicalBrowsingContextGroup.cpp
+++ b/Tests/LibWebView/TestCanonicalBrowsingContextGroup.cpp
@@ -109,7 +109,6 @@ TEST_CASE(target_snapshot_params_take_the_popup_or_container_sandboxing_flags)
frame.set_hosted_state({
.active_document_url = URL::about_blank(),
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = embedder,
.delays_the_load_event_of_its_container = false,
@@ -164,7 +163,6 @@ TEST_CASE(response_browsing_context_is_activated_only_at_commit)
Web::HTML::HostedNavigableState committed_state {
.active_document_url = destination_url,
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = {},
.delays_the_load_event_of_its_container = false,
@@ -209,7 +207,6 @@ TEST_CASE(child_navigation_under_a_document_that_switched_groups_uses_its_group)
Web::HTML::HostedNavigableState committed_state {
.active_document_url = destination_url,
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = {},
.delays_the_load_event_of_its_container = false,
@@ -290,7 +287,6 @@ TEST_CASE(document_claimed_by_a_history_job_outlives_a_newer_navigation)
Web::HTML::HostedNavigableState committed_state {
.active_document_url = URL::about_blank(),
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = {},
.delays_the_load_event_of_its_container = false,
@@ -317,7 +313,6 @@ TEST_CASE(populated_document_replaces_tracked_load_when_document_state_is_reused
Web::HTML::HostedNavigableState committed_state {
.active_document_url = destination_url,
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = {},
.delays_the_load_event_of_its_container = false,
@@ -337,7 +332,6 @@ TEST_CASE(same_document_traversal_commits_only_navigations_admitted_before_it)
return Web::HTML::HostedNavigableState {
.active_document_url = URL::about_blank(),
.active_document_is_fully_active = true,
- .opener_policy = {},
.is_closing = false,
.container = {},
.delays_the_load_event_of_its_container = false,