diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index dcbf4f73db194..83b8fb7c895a8 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc @@ -8397,13 +8397,19 @@ void NavigationRequest::Resume(NavigationThrottle* resuming_throttle) { if (response_body_watcher_) { CHECK(response_body_callback_); response_body_watcher_.reset(); + // |resuming_throttle| is owned by |throttle_registry_| which is owned by + // |this|. If the callback below destroys |this|, |resuming_throttle| is + // freed too. Snapshot the name now so we never read through a dangling + // pointer in the WasInvalidated() branch. + const std::string resuming_throttle_name = + resuming_throttle->GetNameForLogging(); base::WeakPtr this_ptr(weak_factory_.GetWeakPtr()); std::move(response_body_callback_).Run(std::string()); if (this_ptr.WasInvalidated()) { // TODO(https://crbug.com/411238078): Replace the debug code with a // comment once we ensure that this is the root cause. SCOPED_CRASH_KEY_STRING32("Bug411238078", "throttle", - resuming_throttle->GetNameForLogging()); + resuming_throttle_name); base::debug::DumpWithoutCrashing(); return; }