[content] Rename RenderFrameHost::IsInactiveAndDisallowReactivation

With new document LifecycleStates like kPrerendering, kPortal,
it becomes crucial to generalize the method name
IsInactiveAndDisallowReactivation, which is widely used to
check for inactive documents.

When IsInactiveAndDisallowReactivation is called in the
kPrerendering state, "reactivate" won't be suitable because
the page may have never been activated.

This CL renames IsInactiveAndDisallowReactivation to
IsInactiveAndDisallowActivation to accommodate all different
states.

BUG=1175866

Change-Id: I7876b480e79bd35eef7afabeb5937b6d3d1749fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2682799
Reviewed-by: Matt Falkenhagen <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Alexander Timin <[email protected]>
Owners-Override: Matt Falkenhagen <[email protected]>
Commit-Queue: Sreeja Kamishetty <[email protected]>
Cr-Commit-Position: refs/heads/master@{#861490}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index 3a9d4ac..3921efd 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -2860,18 +2860,19 @@
     FrameTreeNode* frame,
     ReloadType reload_type) {
   RenderFrameHostImpl* render_frame_host = frame->current_frame_host();
-  // Only active and prerendered frames can navigate.
+  // Only active and prerendered documents are allowed to navigate in their
+  // frame.
   if (render_frame_host->lifecycle_state() !=
       RenderFrameHostImpl::LifecycleState::kPrerendering) {
-    // - If the frame is in pending deletion, the browser already committed to
-    // destroying this RenderFrameHost. See https://crbug.com/930278.
-    // - If the frame is in back-forward cache, it's not allowed to navigate as
-    // it should remain frozen. Ignore the request and evict the document from
-    // back-forward cache.
+    // - If the document is in pending deletion, the browser already committed
+    // to destroying this RenderFrameHost. See https://crbug.com/930278.
+    // - If the document is in back-forward cache, it's not allowed to navigate
+    // as it should remain frozen. Ignore the request and evict the document
+    // from back-forward cache.
     //
-    // If the frame is inactive, there's no need to recurse into subframes,
+    // If the document is inactive, there's no need to recurse into subframes,
     // which should all be inactive as well.
-    if (render_frame_host->IsInactiveAndDisallowReactivation())
+    if (render_frame_host->IsInactiveAndDisallowActivation())
       return HistoryNavigationAction::kStopLooking;
   }
 
@@ -3690,18 +3691,20 @@
     const GURL& url,
     const std::string& error_page_html,
     net::Error error) {
-  // Only active frames can load post-commit error pages:
-  // - If the frame is in pending deletion, the browser already committed to
-  // destroying this RenderFrameHost so ignore loading the error page.
-  // - If the frame is in back-forward cache, it's not allowed to navigate as it
-  // should remain frozen. Ignore the request and evict the document from
-  // back-forward cache.
-  if (static_cast<RenderFrameHostImpl*>(render_frame_host)
-          ->IsInactiveAndDisallowReactivation()) {
-    return;
-  }
   RenderFrameHostImpl* rfhi =
       static_cast<RenderFrameHostImpl*>(render_frame_host);
+
+  // Only active documents can load post-commit error pages:
+  // - If the document is in pending deletion, the browser already committed to
+  // destroying this RenderFrameHost so ignore loading the error page.
+  // - If the document is in back-forward cache, it's not allowed to navigate as
+  // it should remain frozen. Ignore the request and evict the document from
+  // back-forward cache.
+  // - If the document is prerendering, it can navigate but when loading error
+  // pages, cancel prerendering.
+  if (rfhi->IsInactiveAndDisallowActivation())
+    return;
+
   FrameTreeNode* node = rfhi->frame_tree_node();
 
   mojom::CommonNavigationParamsPtr common_params =