Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: content/public/test/navigation_simulator.cc

Issue 2744593004: Fix use-after-free in NavigationSimulator test util (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/navigation_simulator.cc
diff --git a/content/public/test/navigation_simulator.cc b/content/public/test/navigation_simulator.cc
index daf4cfb9b28e43afa5a8c264558fa853a4c2e410..ffd2485f1f77af393490e4717780544621a65769 100644
--- a/content/public/test/navigation_simulator.cc
+++ b/content/public/test/navigation_simulator.cc
@@ -230,6 +230,11 @@ void NavigationSimulator::Commit() {
if (IsBrowserSideNavigationEnabled() &&
render_frame_host_->frame_tree_node()->navigation_request()) {
render_frame_host_->PrepareForCommit();
+ // Synchronous failure can cause the navigation to finish here.
+ if (!handle_) {
+ state_ = FAILED;
+ return;
+ }
}
// Call NavigationHandle::WillProcessResponse if needed.
@@ -508,8 +513,10 @@ void NavigationSimulator::ReadyToCommitNavigation(
void NavigationSimulator::DidFinishNavigation(
NavigationHandle* navigation_handle) {
- if (navigation_handle == handle_)
+ if (navigation_handle == handle_) {
num_did_finish_navigation_called_++;
+ handle_ = nullptr;
+ }
}
void NavigationSimulator::OnWillStartRequest() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698