Add log message to out-of-bounds NOTREACHED in NavigationControllerImpl::GoToIndex()
We've seen reports of GoToIndex() being called with an out-of-bounds
index on Android WebView. To get more clarity on what the index is,
this CL adds a log message and debug aliases with the index and the
current size of the entries list.
Bug: 1411462
Change-Id: I02e5bc61a084dfb0b6628b5e6f5c9018a4d74faa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4207553
Reviewed-by: Charlie Reis <[email protected]>
Commit-Queue: Rakina Zata Amni <[email protected]>
Reviewed-by: Peter Boström <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1099633}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index 0314b23..6f4aee4 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -1133,7 +1133,14 @@
TRACE_EVENT0("browser,navigation,benchmark",
"NavigationControllerImpl::GoToIndex");
if (index < 0 || index >= static_cast<int>(entries_.size())) {
- NOTREACHED();
+ // We've seen reports of this NOTREACHED being hit on Android WebView, where
+ // we won't get the log message below. The following code ensures that
+ // `index` and `entries_size` will show up on the minidump for that case.
+ base::debug::Alias(&index);
+ const size_t entries_size = entries_.size();
+ base::debug::Alias(&entries_size);
+ NOTREACHED() << "Index " << index
+ << " is out of bounds, entries_.size() is " << entries_size;
return;
}