App history API to navigation API rename (4/n)

See https://github.com/WICG/navigation-api/issues/83 and
https://github.com/WICG/navigation-api/pull/203 for context.

This CL renames various "AppHistoryEntry" data structures and fields to
"NavigationApiHistoryEntry". This crosses the Blink/browser boundary.

Bug: 1300246
Change-Id: I878affd6c1ca2660b5d574bab8582467c9b51293
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3523006
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Nate Chapin <[email protected]>
Commit-Queue: Domenic Denicola <[email protected]>
Cr-Commit-Position: refs/heads/main@{#981872}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index 45121da..317ac39 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -3722,7 +3722,7 @@
               network::mojom::WebClientHintsType>() /* enabled_client_hints */,
           false /* is_cross_browsing_instance */, nullptr /* old_page_info */,
           -1 /* http_response_code */,
-          blink::mojom::AppHistoryEntryArrays::New(),
+          blink::mojom::NavigationApiHistoryEntryArrays::New(),
           std::vector<GURL>() /* early_hints_preloaded_resources */,
           absl::nullopt /* ad_auction_components */,
           // This timestamp will be populated when the commit IPC is sent.
@@ -4308,8 +4308,8 @@
   NotifyEntryChanged(entry);
 }
 
-std::vector<blink::mojom::AppHistoryEntryPtr>
-NavigationControllerImpl::PopulateSingleAppHistoryEntryVector(
+std::vector<blink::mojom::NavigationApiHistoryEntryPtr>
+NavigationControllerImpl::PopulateSingleNavigationApiHistoryEntryVector(
     Direction direction,
     int entry_index,
     const url::Origin& pending_origin,
@@ -4317,7 +4317,7 @@
     SiteInstance* site_instance,
     int64_t pending_item_sequence_number,
     int64_t pending_document_sequence_number) {
-  std::vector<blink::mojom::AppHistoryEntryPtr> entries;
+  std::vector<blink::mojom::NavigationApiHistoryEntryPtr> entries;
   if (GetLastCommittedEntry() && GetLastCommittedEntry()->IsInitialEntry()) {
     // Don't process the initial entry.
     DCHECK_EQ(GetEntryCount(), 1);
@@ -4330,9 +4330,10 @@
     FrameNavigationEntry* frame_entry = GetEntryAtIndex(i)->GetFrameEntry(node);
     if (!frame_entry)
       break;
-    // An entry should only appear in appHistory entries if it is for the same
-    // origin as the document being committed. Check the committed origin, or if
-    // that is not available (during restore), check against the FNE's url.
+    // An entry should only appear in the navigation API entries if it is for
+    // the same origin as the document being committed. Check the committed
+    // origin, or if that is not available (during restore), check against the
+    // FNE's url.
     url::Origin frame_entry_origin =
         frame_entry->committed_origin().value_or(url::Origin::Resolve(
             frame_entry->url(),
@@ -4348,7 +4349,7 @@
 
       // If the document represented by this FNE hid its full url from appearing
       // in a referrer via a "no-referrer" or "origin" referrer policy, censor
-      // the url in appHistory as well (unless we're navigating to that
+      // the url in the navigation API as well (unless we're navigating to that
       // document).
       std::u16string url;
       if (pending_document_sequence_number ==
@@ -4357,8 +4358,8 @@
         url = frame_state.url_string.value_or(std::u16string());
       }
 
-      blink::mojom::AppHistoryEntryPtr entry =
-          blink::mojom::AppHistoryEntry::New(
+      blink::mojom::NavigationApiHistoryEntryPtr entry =
+          blink::mojom::NavigationApiHistoryEntry::New(
               frame_state.app_history_key.value_or(std::u16string()),
               frame_state.app_history_id.value_or(std::u16string()), url,
               frame_state.item_sequence_number,
@@ -4379,8 +4380,8 @@
   return entries;
 }
 
-blink::mojom::AppHistoryEntryArraysPtr
-NavigationControllerImpl::GetAppHistoryEntryVectors(
+blink::mojom::NavigationApiHistoryEntryArraysPtr
+NavigationControllerImpl::GetNavigationApiHistoryEntryVectors(
     FrameTreeNode* node,
     NavigationRequest* request) {
   url::Origin pending_origin =
@@ -4418,17 +4419,18 @@
     }
   }
 
-  auto entry_arrays = blink::mojom::AppHistoryEntryArrays::New();
-  entry_arrays->back_entries = PopulateSingleAppHistoryEntryVector(
+  auto entry_arrays = blink::mojom::NavigationApiHistoryEntryArrays::New();
+  entry_arrays->back_entries = PopulateSingleNavigationApiHistoryEntryVector(
       Direction::kBack, entry_index, pending_origin, node, site_instance.get(),
       pending_item_sequence_number, pending_document_sequence_number);
 
   // Don't populate forward entries if they will be truncated by a new entry.
   if (!will_create_new_entry) {
-    entry_arrays->forward_entries = PopulateSingleAppHistoryEntryVector(
-        Direction::kForward, entry_index, pending_origin, node,
-        site_instance.get(), pending_item_sequence_number,
-        pending_document_sequence_number);
+    entry_arrays->forward_entries =
+        PopulateSingleNavigationApiHistoryEntryVector(
+            Direction::kForward, entry_index, pending_origin, node,
+            site_instance.get(), pending_item_sequence_number,
+            pending_document_sequence_number);
   }
   return entry_arrays;
 }
diff --git a/content/browser/renderer_host/navigation_controller_impl.h b/content/browser/renderer_host/navigation_controller_impl.h
index cfcee8e3f1..16b8c9b 100644
--- a/content/browser/renderer_host/navigation_controller_impl.h
+++ b/content/browser/renderer_host/navigation_controller_impl.h
@@ -32,7 +32,7 @@
 #include "services/network/public/mojom/source_location.mojom-forward.h"
 #include "third_party/abseil-cpp/absl/types/optional.h"
 #include "third_party/blink/public/common/tokens/tokens.h"
-#include "third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom-forward.h"
+#include "third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom-forward.h"
 #include "third_party/blink/public/mojom/navigation/navigation_params.mojom-forward.h"
 
 namespace blink {
@@ -398,9 +398,9 @@
   // |request| may be nullptr when getting entries for an iframe that is being
   // restored for back/forward cache (in that case, the iframe itself is not
   // navigated, so there is no NavigationRequest).
-  blink::mojom::AppHistoryEntryArraysPtr GetAppHistoryEntryVectors(
-      FrameTreeNode* node,
-      NavigationRequest* request);
+  blink::mojom::NavigationApiHistoryEntryArraysPtr
+  GetNavigationApiHistoryEntryVectors(FrameTreeNode* node,
+                                      NavigationRequest* request);
 
   // The appHistory API exposes the urls of some non-current same-origin
   // FrameNavigationEntries to the renderer. This helper checks whether the
@@ -729,16 +729,18 @@
   // GetLastCommittedEntryIndex() and length is GetEntryCount().
   void BroadcastHistoryOffsetAndLength();
 
-  // Used by PopulateAppHistoryEntryVectors to initialize a single vector.
+  // Used by PopulateNavigationApiHistoryEntryVectors to initialize a single
+  // vector.
   enum class Direction { kForward, kBack };
-  std::vector<blink::mojom::AppHistoryEntryPtr>
-  PopulateSingleAppHistoryEntryVector(Direction direction,
-                                      int entry_index,
-                                      const url::Origin& pending_origin,
-                                      FrameTreeNode* node,
-                                      SiteInstance* site_instance,
-                                      int64_t pending_item_sequence_number,
-                                      int64_t pending_document_sequence_number);
+  std::vector<blink::mojom::NavigationApiHistoryEntryPtr>
+  PopulateSingleNavigationApiHistoryEntryVector(
+      Direction direction,
+      int entry_index,
+      const url::Origin& pending_origin,
+      FrameTreeNode* node,
+      SiteInstance* site_instance,
+      int64_t pending_item_sequence_number,
+      int64_t pending_document_sequence_number);
   // Helper for NavigateToAppHistoryKey(). Ensures that we only navigate to
   // |target_entry| if it matches |current_entry|'s origin and site instance, as
   // well as having |app_history_key| as its key.
diff --git a/content/browser/renderer_host/navigation_entry_impl.cc b/content/browser/renderer_host/navigation_entry_impl.cc
index a4aaa62..0ed0f7c 100644
--- a/content/browser/renderer_host/navigation_entry_impl.cc
+++ b/content/browser/renderer_host/navigation_entry_impl.cc
@@ -924,7 +924,7 @@
               network::mojom::WebClientHintsType>() /* enabled_client_hints */,
           false /* is_cross_browsing_instance */, nullptr /* old_page_info */,
           -1 /* http_response_code */,
-          blink::mojom::AppHistoryEntryArrays::New(),
+          blink::mojom::NavigationApiHistoryEntryArrays::New(),
           std::vector<GURL>() /* early_hints_preloaded_resources */,
           absl::nullopt /* ad_auction_components */,
           // This timestamp will be populated when the commit IPC is sent.
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
index 6b502c76..65e021d 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -1166,7 +1166,7 @@
           std::vector<network::mojom::WebClientHintsType>(),
           /*is_cross_browsing_instance=*/false,
           /*old_page_info=*/nullptr, /*http_response_code=*/-1,
-          blink::mojom::AppHistoryEntryArrays::New(),
+          blink::mojom::NavigationApiHistoryEntryArrays::New(),
           /*early_hints_preloaded_resources=*/
           std::vector<GURL>(), absl::nullopt /* ad_auction_components */,
           // This timestamp will be populated when the commit IPC is sent.
@@ -1289,7 +1289,8 @@
           std::vector<
               network::mojom::WebClientHintsType>() /* enabled_client_hints */,
           false /* is_cross_browsing_instance */, nullptr /* old_page_info */,
-          http_response_code, blink::mojom::AppHistoryEntryArrays::New(),
+          http_response_code,
+          blink::mojom::NavigationApiHistoryEntryArrays::New(),
           std::vector<GURL>() /* early_hints_preloaded_resources */,
           absl::nullopt /* ad_auction_components */,
           // This timestamp will be populated when the commit IPC is sent.
@@ -4601,9 +4602,9 @@
   }
 
   if (!IsSameDocument()) {
-    commit_params_->app_history_entry_arrays =
-        GetNavigationController()->GetAppHistoryEntryVectors(frame_tree_node_,
-                                                             this);
+    commit_params_->navigation_api_history_entry_arrays =
+        GetNavigationController()->GetNavigationApiHistoryEntryVectors(
+            frame_tree_node_, this);
   }
 
   if (early_hints_manager_) {
@@ -4672,10 +4673,10 @@
     if (!activated_entry)
       return;
 
-    // Restore appHistory entries, since they will probably have changed since
-    // the page entered bfcache. We must update all frames, not just the top
-    // frame, because it is possible (though unlikely) that an iframe's entries
-    // have changed, too.
+    // Restore navigation API entries, since they will probably have changed
+    // since the page entered bfcache. We must update all frames, not just the
+    // top frame, because it is possible (though unlikely) that an iframe's
+    // entries have changed, too.
     activated_entry->render_frame_host()->ForEachRenderFrameHost(
         base::BindRepeating(
             [](content::RenderFrameHost* navigating_rfh,
@@ -4683,14 +4684,17 @@
               RenderFrameHostImpl* rfhi =
                   static_cast<RenderFrameHostImpl*>(rfh);
               // |request| is given as a parameter to
-              // GetAppHistoryEntryVectors() only for the frame being committed
-              // (i.e., the top frame).
+              // GetNavigationApiHistoryEntryVectors() only for the frame being
+              // committed (i.e., the top frame).
               auto entry_arrays =
-                  rfhi->frame_tree()->controller().GetAppHistoryEntryVectors(
-                      rfhi->frame_tree_node(),
-                      navigating_rfh == rfh ? request : nullptr);
-              rfhi->GetAssociatedLocalFrame()->SetAppHistoryEntriesForRestore(
-                  std::move(entry_arrays));
+                  rfhi->frame_tree()
+                      ->controller()
+                      .GetNavigationApiHistoryEntryVectors(
+                          rfhi->frame_tree_node(),
+                          navigating_rfh == rfh ? request : nullptr);
+              rfhi->GetAssociatedLocalFrame()
+                  ->SetNavigationApiHistoryEntriesForRestore(
+                      std::move(entry_arrays));
               return content::RenderFrameHost::FrameIterationAction::kContinue;
             },
             activated_entry->render_frame_host(), this));
diff --git a/content/public/test/fake_local_frame.cc b/content/public/test/fake_local_frame.cc
index b3d8648..6b26d7d 100644
--- a/content/public/test/fake_local_frame.cc
+++ b/content/public/test/fake_local_frame.cc
@@ -188,8 +188,8 @@
 void FakeLocalFrame::GetCanonicalUrlForSharing(
     base::OnceCallback<void(const absl::optional<GURL>&)> callback) {}
 
-void FakeLocalFrame::SetAppHistoryEntriesForRestore(
-    blink::mojom::AppHistoryEntryArraysPtr entry_arrays) {}
+void FakeLocalFrame::SetNavigationApiHistoryEntriesForRestore(
+    blink::mojom::NavigationApiHistoryEntryArraysPtr entry_arrays) {}
 
 void FakeLocalFrame::BindFrameHostReceiver(
     mojo::ScopedInterfaceEndpointHandle handle) {
diff --git a/content/public/test/fake_local_frame.h b/content/public/test/fake_local_frame.h
index 20739424..4c29a38 100644
--- a/content/public/test/fake_local_frame.h
+++ b/content/public/test/fake_local_frame.h
@@ -15,7 +15,7 @@
 #include "third_party/blink/public/mojom/frame/frame.mojom.h"
 #include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom.h"
 #include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h"
-#include "third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom.h"
+#include "third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom.h"
 
 namespace gfx {
 class Point;
@@ -140,8 +140,8 @@
   void HandleRendererDebugURL(const GURL& url) override;
   void GetCanonicalUrlForSharing(
       base::OnceCallback<void(const absl::optional<GURL>&)> callback) override;
-  void SetAppHistoryEntriesForRestore(
-      blink::mojom::AppHistoryEntryArraysPtr entry_arrays) override;
+  void SetNavigationApiHistoryEntriesForRestore(
+      blink::mojom::NavigationApiHistoryEntryArraysPtr entry_arrays) override;
 
  private:
   void BindFrameHostReceiver(mojo::ScopedInterfaceEndpointHandle handle);
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 345f6880..1a49eb0 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -989,8 +989,8 @@
   return renderer_navigation_timings;
 }
 
-WebHistoryItem AppHistoryEntryPtrToWebHistoryItem(
-    const blink::mojom::AppHistoryEntry& entry) {
+WebHistoryItem NavigationApiHistoryEntryPtrToWebHistoryItem(
+    const blink::mojom::NavigationApiHistoryEntry& entry) {
   WebHistoryItem item;
   item.Initialize();
   item.SetAppHistoryKey(WebString::FromUTF16(entry.key));
@@ -1068,19 +1068,19 @@
   if (commit_params.http_response_code != -1)
     navigation_params->http_status_code = commit_params.http_response_code;
 
-  // Populate the arrays of non-current entries for the appHistory API.
-  auto& entry_arrays = commit_params.app_history_entry_arrays;
-  navigation_params->app_history_back_entries.reserve(
+  // Populate the arrays of non-current entries for the window.navigation API.
+  auto& entry_arrays = commit_params.navigation_api_history_entry_arrays;
+  navigation_params->navigation_api_back_entries.reserve(
       entry_arrays->back_entries.size());
   for (const auto& entry : entry_arrays->back_entries) {
-    navigation_params->app_history_back_entries.emplace_back(
-        AppHistoryEntryPtrToWebHistoryItem(*entry));
+    navigation_params->navigation_api_back_entries.emplace_back(
+        NavigationApiHistoryEntryPtrToWebHistoryItem(*entry));
   }
-  navigation_params->app_history_forward_entries.reserve(
+  navigation_params->navigation_api_forward_entries.reserve(
       entry_arrays->forward_entries.size());
   for (const auto& entry : entry_arrays->forward_entries) {
-    navigation_params->app_history_forward_entries.emplace_back(
-        AppHistoryEntryPtrToWebHistoryItem(*entry));
+    navigation_params->navigation_api_forward_entries.emplace_back(
+        NavigationApiHistoryEntryPtrToWebHistoryItem(*entry));
   }
 
   if (commit_params.ad_auction_components) {
diff --git a/third_party/blink/common/navigation/navigation_params.cc b/third_party/blink/common/navigation/navigation_params.cc
index 48e121d0..44ba8707 100644
--- a/third_party/blink/common/navigation/navigation_params.cc
+++ b/third_party/blink/common/navigation/navigation_params.cc
@@ -21,7 +21,8 @@
   auto commit_params = mojom::CommitNavigationParams::New();
   commit_params->navigation_token = base::UnguessableToken::Create();
   commit_params->navigation_timing = mojom::NavigationTiming::New();
-  commit_params->app_history_entry_arrays = mojom::AppHistoryEntryArrays::New();
+  commit_params->navigation_api_history_entry_arrays =
+      mojom::NavigationApiHistoryEntryArrays::New();
 
   return commit_params;
 }
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn
index 0bec7c5..a13d6b39 100644
--- a/third_party/blink/public/mojom/BUILD.gn
+++ b/third_party/blink/public/mojom/BUILD.gn
@@ -131,7 +131,7 @@
     "mediastream/media_stream.mojom",
     "mime/mime_registry.mojom",
     "native_io/native_io.mojom",
-    "navigation/app_history_entry_arrays.mojom",
+    "navigation/navigation_api_history_entry_arrays.mojom",
     "navigation/navigation_policy.mojom",
     "navigation/prefetched_signed_exchange_info.mojom",
     "navigation/renderer_eviction_reason.mojom",
diff --git a/third_party/blink/public/mojom/frame/frame.mojom b/third_party/blink/public/mojom/frame/frame.mojom
index dbc607e..b67c4e9 100644
--- a/third_party/blink/public/mojom/frame/frame.mojom
+++ b/third_party/blink/public/mojom/frame/frame.mojom
@@ -53,7 +53,7 @@
 import "third_party/blink/public/mojom/frame/viewport_intersection_state.mojom";
 import "third_party/blink/public/mojom/input/focus_type.mojom";
 import "third_party/blink/public/mojom/input/scroll_direction.mojom";
-import "third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom";
+import "third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom";
 import "third_party/blink/public/mojom/navigation/navigation_policy.mojom";
 import "third_party/blink/public/mojom/loader/referrer.mojom";
 import "third_party/blink/public/mojom/widget/platform_widget.mojom";
@@ -839,12 +839,12 @@
   // the document of this frame doesn't have the HTMLLinkElement.
   GetCanonicalUrlForSharing() => (url.mojom.Url? canonical_url);
 
-  // Updates appHistory.entries() when restoring from bfcache.
-  // appHistory.entries() represents a subset of the back/forward list visible
+  // Updates navigation.entries() when restoring from bfcache.
+  // navigation.entries() represents a subset of the back/forward list visible
   // to this frame, and that subset may have changed while the page was in
   // bfcache.
-  SetAppHistoryEntriesForRestore(
-      AppHistoryEntryArrays app_history_entry_arrays);
+  SetNavigationApiHistoryEntriesForRestore(
+      NavigationApiHistoryEntryArrays entry_arrays);
 };
 
 // Also implemented in Blink, this interface defines frame-specific methods
diff --git a/third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom b/third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom
deleted file mode 100644
index b3ae9b3..0000000
--- a/third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module blink.mojom;
-
-import "mojo/public/mojom/base/string16.mojom";
-
-// AppHistoryEntry contains a subset of a session history item that is used by
-// the appHistory API to represent a non-current history entry. The browser
-// ensures that an AppHistoryEntry is only sent to the renderer if its |url| is
-// same-origin to the navigation being committed.
-struct AppHistoryEntry {
-  mojo_base.mojom.String16 key;
-  mojo_base.mojom.String16 id;
-  // |url| is represented as a string rather than a url.mojom.Url in keeping
-  // with the FrameState mojo struct doing so (from which |url| is derived).
-  mojo_base.mojom.String16 url;
-  int64 item_sequence_number;
-  int64 document_sequence_number;
-  mojo_base.mojom.String16 state;
-};
-
-// A same-origin subset of the back/forward list exposed by the appHistory
-// API.
-struct AppHistoryEntryArrays {
-  array<AppHistoryEntry> back_entries;
-  array<AppHistoryEntry> forward_entries;
-};
diff --git a/third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom b/third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom
new file mode 100644
index 0000000..1dbc48a
--- /dev/null
+++ b/third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom
@@ -0,0 +1,29 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module blink.mojom;
+
+import "mojo/public/mojom/base/string16.mojom";
+
+// The NavigationApiHistoryEntry contains a subset of a session history item
+// that is used by the window.navigation API to represent a non-current history
+// entry. The browser ensures that a NavigationApiHistoryEntry is only sent to
+// the renderer if its |url| is same-origin to the navigation being committed.
+struct NavigationApiHistoryEntry {
+  mojo_base.mojom.String16 key;
+  mojo_base.mojom.String16 id;
+  // |url| is represented as a string rather than a url.mojom.Url in keeping
+  // with the FrameState mojo struct doing so (from which |url| is derived).
+  mojo_base.mojom.String16 url;
+  int64 item_sequence_number;
+  int64 document_sequence_number;
+  mojo_base.mojom.String16 state;
+};
+
+// A same-origin subset of the back/forward list exposed by the
+// window.navigation API.
+struct NavigationApiHistoryEntryArrays {
+  array<NavigationApiHistoryEntry> back_entries;
+  array<NavigationApiHistoryEntry> forward_entries;
+};
diff --git a/third_party/blink/public/mojom/navigation/navigation_params.mojom b/third_party/blink/public/mojom/navigation/navigation_params.mojom
index 3e47498..926c92d 100644
--- a/third_party/blink/public/mojom/navigation/navigation_params.mojom
+++ b/third_party/blink/public/mojom/navigation/navigation_params.mojom
@@ -21,7 +21,7 @@
 import "third_party/blink/public/mojom/frame/frame_policy.mojom";
 import "third_party/blink/public/mojom/loader/mixed_content.mojom";
 import "third_party/blink/public/mojom/loader/referrer.mojom";
-import "third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom";
+import "third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom";
 import "third_party/blink/public/mojom/navigation/navigation_policy.mojom";
 import "third_party/blink/public/mojom/navigation/prefetched_signed_exchange_info.mojom";
 import "third_party/blink/public/mojom/navigation/was_activated_option.mojom";
@@ -458,9 +458,9 @@
   // received response headers.
   int32 http_response_code = -1;
 
-  // A same-origin subset of the back/forward list exposed by the appHistory
-  // API.
-  AppHistoryEntryArrays app_history_entry_arrays;
+  // A same-origin subset of the back/forward list exposed by the
+  // window.navigation API.
+  NavigationApiHistoryEntryArrays navigation_api_history_entry_arrays;
 
   array<url.mojom.Url> early_hints_preloaded_resources;
 
diff --git a/third_party/blink/public/web/web_navigation_params.h b/third_party/blink/public/web/web_navigation_params.h
index 1eee687..69b818e 100644
--- a/third_party/blink/public/web/web_navigation_params.h
+++ b/third_party/blink/public/web/web_navigation_params.h
@@ -431,10 +431,10 @@
   std::unique_ptr<WebPolicyContainer> policy_container;
 
   // These are used to construct a subset of the back/forward list for the
-  // appHistory API. They only have the attributes that are needed for
-  // appHistory.
-  WebVector<WebHistoryItem> app_history_back_entries;
-  WebVector<WebHistoryItem> app_history_forward_entries;
+  // window.navigation API. They only have the attributes that are needed for
+  // that API.
+  WebVector<WebHistoryItem> navigation_api_back_entries;
+  WebVector<WebHistoryItem> navigation_api_forward_entries;
 
   // List of URLs which are preloaded by HTTP Early Hints.
   WebVector<WebURL> early_hints_preloaded_resources;
diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
index 4e46ee8..ae0829a 100644
--- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
@@ -1149,8 +1149,8 @@
 #endif
 }
 
-void LocalFrameMojoHandler::SetAppHistoryEntriesForRestore(
-    mojom::blink::AppHistoryEntryArraysPtr entry_arrays) {
+void LocalFrameMojoHandler::SetNavigationApiHistoryEntriesForRestore(
+    mojom::blink::NavigationApiHistoryEntryArraysPtr entry_arrays) {
   if (NavigationApi* navigation_api =
           NavigationApi::navigation(*frame_->DomWindow()))
     navigation_api->SetEntriesForRestore(entry_arrays);
diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h
index 1ea32377..5e99569 100644
--- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h
+++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h
@@ -192,8 +192,8 @@
   void GetCanonicalUrlForSharing(
       GetCanonicalUrlForSharingCallback callback) final;
 
-  void SetAppHistoryEntriesForRestore(
-      mojom::blink::AppHistoryEntryArraysPtr) final;
+  void SetNavigationApiHistoryEntriesForRestore(
+      mojom::blink::NavigationApiHistoryEntryArraysPtr) final;
 
   // blink::mojom::LocalMainFrame overrides:
   void AnimateDoubleTapZoom(const gfx::Point& point,
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc
index ee7de79..c137412 100644
--- a/third_party/blink/renderer/core/loader/document_loader.cc
+++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -312,8 +312,8 @@
   bool origin_agent_cluster;
   bool origin_agent_cluster_left_as_default;
   bool is_cross_site_cross_browsing_context_group;
-  WebVector<WebHistoryItem> app_history_back_entries;
-  WebVector<WebHistoryItem> app_history_forward_entries;
+  WebVector<WebHistoryItem> navigation_api_back_entries;
+  WebVector<WebHistoryItem> navigation_api_forward_entries;
   std::unique_ptr<CodeCacheHost> code_cache_host;
   HashSet<KURL> early_hints_preloaded_resources;
   absl::optional<Vector<KURL>> ad_auction_components;
@@ -414,8 +414,8 @@
           params_->origin_agent_cluster_left_as_default),
       is_cross_site_cross_browsing_context_group_(
           params_->is_cross_site_cross_browsing_context_group),
-      app_history_back_entries_(params_->app_history_back_entries),
-      app_history_forward_entries_(params_->app_history_forward_entries),
+      navigation_api_back_entries_(params_->navigation_api_back_entries),
+      navigation_api_forward_entries_(params_->navigation_api_forward_entries),
       anonymous_(params_->anonymous) {
   DCHECK(frame_);
 
@@ -2404,12 +2404,12 @@
     NavigationApi::From(*frame_->DomWindow())
         ->InitializeForNewWindow(*history_item_, load_type_, commit_reason_,
                                  NavigationApi::navigation(*previous_window),
-                                 app_history_back_entries_,
-                                 app_history_forward_entries_);
+                                 navigation_api_back_entries_,
+                                 navigation_api_forward_entries_);
     // Now that the navigation API's entries array is initialized, we don't need
     // to retain the state from which it was initialized.
-    app_history_back_entries_.Clear();
-    app_history_forward_entries_.Clear();
+    navigation_api_back_entries_.Clear();
+    navigation_api_forward_entries_.Clear();
   }
 
   if (commit_reason_ == CommitReason::kXSLT)
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h
index 7bf0530f..e2906a23 100644
--- a/third_party/blink/renderer/core/loader/document_loader.h
+++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -638,8 +638,8 @@
   // BrowsingContextGroup.
   bool is_cross_site_cross_browsing_context_group_ = false;
 
-  WebVector<WebHistoryItem> app_history_back_entries_;
-  WebVector<WebHistoryItem> app_history_forward_entries_;
+  WebVector<WebHistoryItem> navigation_api_back_entries_;
+  WebVector<WebHistoryItem> navigation_api_forward_entries_;
 
   // This is the interface that handles generated code cache
   // requests to fetch code cache when loading resources.
diff --git a/third_party/blink/renderer/core/navigation_api/navigation_api.cc b/third_party/blink/renderer/core/navigation_api/navigation_api.cc
index 6d20791e..618dc81 100644
--- a/third_party/blink/renderer/core/navigation_api/navigation_api.cc
+++ b/third_party/blink/renderer/core/navigation_api/navigation_api.cc
@@ -346,7 +346,7 @@
 }
 
 NavigationHistoryEntry* NavigationApi::GetEntryForRestore(
-    const mojom::blink::AppHistoryEntryPtr& entry) {
+    const mojom::blink::NavigationApiHistoryEntryPtr& entry) {
   const auto& it = keys_to_indices_.find(entry->key);
   if (it != keys_to_indices_.end()) {
     NavigationHistoryEntry* existing_entry = entries_[it->value];
@@ -376,7 +376,7 @@
 }
 
 void NavigationApi::SetEntriesForRestore(
-    const mojom::blink::AppHistoryEntryArraysPtr& entry_arrays) {
+    const mojom::blink::NavigationApiHistoryEntryArraysPtr& entry_arrays) {
   // If this window HasEntriesAndEventsDisabled(), we shouldn't attempt to
   // restore anything.
   if (HasEntriesAndEventsDisabled())
diff --git a/third_party/blink/renderer/core/navigation_api/navigation_api.h b/third_party/blink/renderer/core/navigation_api/navigation_api.h
index 159f1e59..4777089 100644
--- a/third_party/blink/renderer/core/navigation_api/navigation_api.h
+++ b/third_party/blink/renderer/core/navigation_api/navigation_api.h
@@ -6,7 +6,7 @@
 #define THIRD_PARTY_BLINK_RENDERER_CORE_NAVIGATION_API_NAVIGATION_API_H_
 
 #include "base/memory/scoped_refptr.h"
-#include "third_party/blink/public/mojom/navigation/app_history_entry_arrays.mojom-blink.h"
+#include "third_party/blink/public/mojom/navigation/navigation_api_history_entry_arrays.mojom-blink.h"
 #include "third_party/blink/public/web/web_frame_load_type.h"
 #include "third_party/blink/public/web/web_history_item.h"
 #include "third_party/blink/renderer/core/core_export.h"
@@ -62,7 +62,8 @@
                               const WebVector<WebHistoryItem>& back_entries,
                               const WebVector<WebHistoryItem>& forward_entries);
   void UpdateForNavigation(HistoryItem&, WebFrameLoadType);
-  void SetEntriesForRestore(const mojom::blink::AppHistoryEntryArraysPtr&);
+  void SetEntriesForRestore(
+      const mojom::blink::NavigationApiHistoryEntryArraysPtr&);
 
   bool HasOngoingNavigation() const { return ongoing_navigation_signal_; }
 
@@ -125,7 +126,7 @@
   friend class NavigationApiNavigation;
   void CloneFromPrevious(NavigationApi&);
   NavigationHistoryEntry* GetEntryForRestore(
-      const mojom::blink::AppHistoryEntryPtr&);
+      const mojom::blink::NavigationApiHistoryEntryPtr&);
   void PopulateKeySet();
   void FinalizeWithAbortedNavigationError(ScriptState*,
                                           NavigationApiNavigation*);