Skip to content

Commit

Permalink
App history API to navigation API rename (6/n)
Browse files Browse the repository at this point in the history
See WICG/navigation-api#83 and
WICG/navigation-api#203 for context.

This CL tidies up remaining references to app history across the
codebase, mostly in comments and in enum names. Some DOMException
messages also were forgotten in previous passes, and needed to be
updated.

Bug: 1300246
Change-Id: I10eeffb0cb6cc753679d45e450c8f5268bd500c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3523471
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#982361}
NOKEYCHECK=True
GitOrigin-RevId: 3081074af94f0a75697fe86807e62ef7f1538b73
  • Loading branch information
domenic authored and copybara-github committed Mar 17, 2022
1 parent f5a8997 commit 309cf27
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions blink/public/mojom/loader/same_document_navigation_type.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ enum SameDocumentNavigationType {
kFragment = 0,
// Navigating with window.history
kHistoryApi = 1,
// Navigating with AppHistoryNavigateEvent's transitionWhile()
kAppHistoryTransitionWhile = 2,
// Navigating with the navigation API NavigateEvent's transitionWhile()
kNavigationApiTransitionWhile = 2,
};
11 changes: 6 additions & 5 deletions blink/renderer/core/loader/document_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,9 @@ static SinglePageAppNavigationType CategorizeSinglePageAppNavigation(
// WebFrameLoadType::kBackForward.
DCHECK(frame_load_type != WebFrameLoadType::kBackForward);
return kSPANavTypeHistoryPushStateOrReplaceState;
case mojom::blink::SameDocumentNavigationType::kAppHistoryTransitionWhile:
return kSPANavTypeAppHistoryTransitionWhile;
case mojom::blink::SameDocumentNavigationType::
kNavigationApiTransitionWhile:
return kSPANavTypeNavigationApiTransitionWhile;
}
NOTREACHED();
return kSPANavTypeSameDocumentBackwardOrForward;
Expand Down Expand Up @@ -818,9 +819,9 @@ void DocumentLoader::UpdateForSameDocumentNavigation(
// NavigateEvent, the navigation will finish asynchronously, so
// don't immediately call DidStopLoading() in that case.
bool should_send_stop_notification =
!was_loading &&
same_document_navigation_type !=
mojom::blink::SameDocumentNavigationType::kAppHistoryTransitionWhile;
!was_loading && same_document_navigation_type !=
mojom::blink::SameDocumentNavigationType::
kNavigationApiTransitionWhile;
if (should_send_stop_notification)
GetFrameLoader().Progress().ProgressCompleted();

Expand Down
2 changes: 1 addition & 1 deletion blink/renderer/core/loader/frame_loader_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum SinglePageAppNavigationType {
kSPANavTypeHistoryPushStateOrReplaceState = 0,
kSPANavTypeSameDocumentBackwardOrForward = 1,
kSPANavTypeOtherFragmentNavigation = 2,
kSPANavTypeAppHistoryTransitionWhile = 3,
kSPANavTypeNavigationApiTransitionWhile = 3,
kSPANavTypeCount
};

Expand Down
8 changes: 4 additions & 4 deletions blink/renderer/core/navigation_api/navigation_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ NavigationResult* NavigationApi::navigate(ScriptState* script_state,
if (options->hasState()) {
ExceptionState exception_state(
script_state->GetIsolate(),
ExceptionContext::Context::kOperationInvoke, "AppHistory",
ExceptionContext::Context::kOperationInvoke, "Navigation",
"navigate");
serialized_state = SerializeState(options->state(), exception_state);
if (exception_state.HadException()) {
Expand Down Expand Up @@ -501,7 +501,7 @@ NavigationResult* NavigationApi::reload(ScriptState* script_state,
if (options->hasState()) {
ExceptionState exception_state(
script_state->GetIsolate(),
ExceptionContext::Context::kOperationInvoke, "AppHistory", "reload");
ExceptionContext::Context::kOperationInvoke, "Navigation", "reload");
serialized_state = SerializeState(options->state(), exception_state);
if (exception_state.HadException()) {
NavigationResult* result =
Expand Down Expand Up @@ -559,7 +559,7 @@ NavigationResult* NavigationApi::traverseTo(ScriptState* script_state,
const String& key,
NavigationOptions* options) {
if (DOMException* maybe_ex =
PerformSharedNavigationChecks("goTo()/back()/forward()")) {
PerformSharedNavigationChecks("traverseTo()/back()/forward()")) {
return EarlyErrorResult(script_state, maybe_ex);
}

Expand Down Expand Up @@ -778,7 +778,7 @@ NavigationApi::DispatchResult NavigationApi::DispatchNavigateEvent(
// steps. Instead it does stuff like the loading spinner and use counters.
GetSupplementable()->document()->Loader()->RunURLAndHistoryUpdateSteps(
url, destination_item,
mojom::blink::SameDocumentNavigationType::kAppHistoryTransitionWhile,
mojom::blink::SameDocumentNavigationType::kNavigationApiTransitionWhile,
state_object, type, is_browser_initiated, is_synchronously_committed);
}

Expand Down

0 comments on commit 309cf27

Please sign in to comment.