Skip to content

Commit 3a91b68

Browse files
committed
fix: add new navigation state REUSE_SITE_INSTANCE
To fix the new set of state checks added in https://chromium-review.googlesource.com/c/chromium/src/+/2215141
1 parent 5f2c86b commit 3a91b68

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

patches/chromium/frame_host_manager.patch

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ index 06f0961e122f326e41610dd7a1b32fa752f0c68f..a041189f79cea5b59e1792b79c1348e3
4242
// another SiteInstance for the same site.
4343
void RegisterSiteInstance(SiteInstanceImpl* site_instance);
4444
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
45-
index 90a4052c97696d85d6fbe3274b999b09fb4015c0..fb30f403dafe1e88ca556849ef43b17ae934fd5c 100644
45+
index 90a4052c97696d85d6fbe3274b999b09fb4015c0..c0be3721db3be1c9da89f227ed4cfb5a36201f30 100644
4646
--- a/content/browser/frame_host/navigation_request.cc
4747
+++ b/content/browser/frame_host/navigation_request.cc
48-
@@ -1406,6 +1406,24 @@ void NavigationRequest::BeginNavigation() {
48+
@@ -1406,6 +1406,21 @@ void NavigationRequest::BeginNavigation() {
4949
// it immediately.
5050
EnterChildTraceEvent("ResponseStarted", this);
5151

@@ -61,15 +61,46 @@ index 90a4052c97696d85d6fbe3274b999b09fb4015c0..fb30f403dafe1e88ca556849ef43b17a
6161
+ // (request->state() >= NavigationRequest::WILL_PROCESS_RESPONSE &&
6262
+ // !speculative_render_frame_host_);
6363
+ //
64-
+ // Hence this call is necesary before the call to GetFrameHostForNavigation. Also
65-
+ // the state_ here is anyway going to end up being READY_TO_COMMIT because of
66-
+ // ReadyToCommitNavigation a few lines later, so will not affect normal chromium
67-
+ // request cycle.
68-
+ state_ = READY_TO_COMMIT;
64+
+ // Hence this call is necesary before the call to GetFrameHostForNavigation.
65+
+ SetState(REUSE_SITE_INSTANCE);
6966
+
7067
// Select an appropriate RenderFrameHost.
7168
render_frame_host_ =
7269
frame_tree_node_->render_manager()->GetFrameHostForNavigation(this);
70+
@@ -4761,13 +4776,15 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const {
71+
{WAITING_FOR_RENDERER_RESPONSE, {WILL_START_NAVIGATION}},
72+
{WILL_START_NAVIGATION, {WILL_START_REQUEST, WILL_FAIL_REQUEST}},
73+
{WILL_START_REQUEST,
74+
- {WILL_REDIRECT_REQUEST, WILL_PROCESS_RESPONSE, READY_TO_COMMIT,
75+
- DID_COMMIT, CANCELING, WILL_FAIL_REQUEST, DID_COMMIT_ERROR_PAGE}},
76+
+ {WILL_REDIRECT_REQUEST, WILL_PROCESS_RESPONSE, REUSE_SITE_INSTANCE,
77+
+ READY_TO_COMMIT, DID_COMMIT, CANCELING, WILL_FAIL_REQUEST,
78+
+ DID_COMMIT_ERROR_PAGE}},
79+
{WILL_REDIRECT_REQUEST,
80+
{WILL_REDIRECT_REQUEST, WILL_PROCESS_RESPONSE, CANCELING,
81+
WILL_FAIL_REQUEST}},
82+
{WILL_PROCESS_RESPONSE,
83+
- {READY_TO_COMMIT, CANCELING, WILL_FAIL_REQUEST}},
84+
+ {REUSE_SITE_INSTANCE, READY_TO_COMMIT, CANCELING, WILL_FAIL_REQUEST}},
85+
+ {REUSE_SITE_INSTANCE, {READY_TO_COMMIT}},
86+
{READY_TO_COMMIT, {NOT_STARTED, DID_COMMIT, DID_COMMIT_ERROR_PAGE}},
87+
{DID_COMMIT, {}},
88+
{CANCELING, {READY_TO_COMMIT, WILL_FAIL_REQUEST}},
89+
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h
90+
index cb004ae1ebd76210f826b988c439f71e221b1ad4..50b6381ae4d9d89658c99c6e8a532d0d065c8dc0 100644
91+
--- a/content/browser/frame_host/navigation_request.h
92+
+++ b/content/browser/frame_host/navigation_request.h
93+
@@ -142,6 +142,10 @@ class CONTENT_EXPORT NavigationRequest
94+
// asynchronous.
95+
WILL_PROCESS_RESPONSE,
96+
97+
+ // Electron: state that is between than WILL_PROCESS_RESPONSE and
98+
+ // READY_TO_COMMIT to force reuse the same site instance.
99+
+ REUSE_SITE_INSTANCE,
100+
+
101+
// The response started on the IO thread and is ready to be committed.
102+
READY_TO_COMMIT,
103+
73104
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
74105
index b9eedf1568e9c2f33fd01a31ba2f0037fde96570..8dc7b5a8351c5901001f1d6f1b44916db5c80ec7 100644
75106
--- a/content/browser/frame_host/render_frame_host_manager.cc

0 commit comments

Comments
 (0)