Add temporary instrumentation into NavigationRequest::BeginNavigation().

This checks AT RUNTIME that no NavigationURLLoader is associated with
the NavigationRequest when BeginNavigation is called.

In particular, the path RestartNavigationAsCrossDocument looks
suspicious to me.

This is temporary, it will be removed when the bug will be closed.

Bug: 936962
Change-Id: I9acb1bc3b22de2aa4a9f7465ae82d9d28134e51c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1528234
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641685}
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index d525637..a61bff6 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -644,6 +644,17 @@
 
 void NavigationRequest::BeginNavigation() {
   DCHECK(!loader_);
+  // TODO(https://crbug.com/936962): Remove this when the bug is fixed.
+  if (loader_) {
+    FrameMsg_Navigate_Type::Value navigation_type =
+        common_params_.navigation_type;
+    base::debug::Alias(&navigation_type);
+    NavigationState state = state_;
+    base::debug::Alias(&state);
+    DEBUG_ALIAS_FOR_GURL(url, common_params_.url);
+    base::debug::DumpWithoutCrashing();
+    loader_.reset();
+  }
   DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE);
   TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationRequest", this,
                                "BeginNavigation");