chromium/third_party/blink/renderer/core/navigation_api/navigation_api.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/navigation_api/navigation_api.h"

#include <memory>
#include <optional>

#include "base/check_op.h"
#include "base/feature_list.h"
#include "third_party/blink/public/mojom/frame/frame.mojom-blink.h"
#include "third_party/blink/public/web/web_frame_load_type.h"
#include "third_party/blink/renderer/bindings/core/v8/capture_source_location.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigate_event_init.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_current_entry_change_event_init.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_history_behavior.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_navigate_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_reload_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_result.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_transition.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_navigation_update_current_entry_options.h"
#include "third_party/blink/renderer/core/dom/abort_controller.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/event_target_names.h"
#include "third_party/blink/renderer/core/events/error_event.h"
#include "third_party/blink/renderer/core/frame/history_util.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/forms/form_data.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/loader/frame_load_request.h"
#include "third_party/blink/renderer/core/navigation_api/navigate_event.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_activation.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_api_method_tracker.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_current_entry_change_event.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_destination.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_history_entry.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_transition.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/timing/soft_navigation_heuristics.h"
#include "third_party/blink/renderer/platform/bindings/exception_context.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/scheduler/public/task_attribution_info.h"
#include "third_party/blink/renderer/platform/scheduler/public/task_attribution_tracker.h"

namespace blink {

namespace {

// Kill switch feature for fixing https://crbug.com/40283021.
// TODO(domenic): clean this up after that fix has baked in stable for a few
// milestones.
BASE_FEATURE();
}  // namespace

template <typename... DOMExceptionArgs>
NavigationResult* EarlyErrorResult(ScriptState* script_state,
                                   DOMExceptionArgs&&... args) {}

NavigationResult* EarlyErrorResult(ScriptState* script_state,
                                   DOMException* ex) {}

NavigationResult* EarlyErrorResult(ScriptState* script_state,
                                   v8::Local<v8::Value> ex) {}

NavigationResult* EarlySuccessResult(ScriptState* script_state,
                                     NavigationHistoryEntry* entry) {}

String DetermineNavigationType(WebFrameLoadType type) {}

NavigationApi::NavigationApi(LocalDOMWindow* window)
    :{}

NavigationActivation* NavigationApi::activation() const {}

void NavigationApi::setOnnavigate(EventListener* listener) {}

void NavigationApi::PopulateKeySet() {}

void NavigationApi::UpdateActivation(HistoryItem* previous_item,
                                     WebFrameLoadType load_type) {}

NavigationHistoryEntry* NavigationApi::GetExistingEntryFor(const String& key,
                                                           const String& id) {}

void NavigationApi::InitializeForNewWindow(
    HistoryItem& current,
    WebFrameLoadType load_type,
    CommitReason commit_reason,
    NavigationApi* previous,
    const WebVector<WebHistoryItem>& back_entries,
    const WebVector<WebHistoryItem>& forward_entries,
    HistoryItem* previous_entry) {}

void NavigationApi::UpdateCurrentEntryForTesting(HistoryItem& item) {}

void NavigationApi::UpdateForNavigation(HistoryItem& item,
                                        WebFrameLoadType type) {}

NavigationHistoryEntry* NavigationApi::GetEntryForRestore(
    const mojom::blink::NavigationApiHistoryEntryPtr& entry) {}

// static
void FireDisposeEventsAsync(
    HeapVector<Member<NavigationHistoryEntry>>* disposed_entries) {}

void NavigationApi::SetEntriesForRestore(
    const mojom::blink::NavigationApiHistoryEntryArraysPtr& entry_arrays,
    mojom::blink::NavigationApiEntryRestoreReason restore_reason) {}

void NavigationApi::DisposeEntriesForSessionHistoryRemoval(
    const Vector<String>& keys) {}

NavigationHistoryEntry* NavigationApi::currentEntry() const {}

HeapVector<Member<NavigationHistoryEntry>> NavigationApi::entries() {}

void NavigationApi::updateCurrentEntry(
    NavigationUpdateCurrentEntryOptions* options,
    ExceptionState& exception_state) {}

NavigationResult* NavigationApi::navigate(ScriptState* script_state,
                                          const String& url,
                                          NavigationNavigateOptions* options) {}

NavigationResult* NavigationApi::reload(ScriptState* script_state,
                                        NavigationReloadOptions* options) {}

NavigationResult* NavigationApi::PerformNonTraverseNavigation(
    ScriptState* script_state,
    FrameLoadRequest& request,
    scoped_refptr<SerializedScriptValue> serialized_state,
    NavigationOptions* options,
    WebFrameLoadType frame_load_type) {}

NavigationResult* NavigationApi::traverseTo(ScriptState* script_state,
                                            const String& key,
                                            NavigationOptions* options) {}

bool NavigationApi::canGoBack() const {}

bool NavigationApi::canGoForward() const {}

NavigationResult* NavigationApi::back(ScriptState* script_state,
                                      NavigationOptions* options) {}

NavigationResult* NavigationApi::forward(ScriptState* script_state,
                                         NavigationOptions* options) {}

DOMException* NavigationApi::PerformSharedNavigationChecks(
    const String& method_name_for_error_message) {}

scoped_refptr<SerializedScriptValue> NavigationApi::SerializeState(
    const ScriptValue& value,
    ExceptionState& exception_state) {}

void NavigationApi::PromoteUpcomingNavigationToOngoing(const String& key) {}

bool NavigationApi::HasEntriesAndEventsDisabled() const {}

NavigationHistoryEntry* NavigationApi::MakeEntryFromItem(HistoryItem& item) {}

NavigationApi::DispatchResult NavigationApi::DispatchNavigateEvent(
    NavigateEventDispatchParams* params) {}

void NavigationApi::InformAboutCanceledNavigation(
    CancelNavigationReason reason) {}

void NavigationApi::TraverseCancelled(
    const String& key,
    mojom::blink::TraverseCancelledReason reason) {}

bool NavigationApi::HasNonDroppedOngoingNavigation() const {}

void NavigationApi::DidFailOngoingNavigation(ScriptValue value) {}

void NavigationApi::DidFinishOngoingNavigation() {}

void NavigationApi::AbortOngoingNavigation(ScriptState* script_state) {}

int NavigationApi::GetIndexFor(NavigationHistoryEntry* entry) {}

const AtomicString& NavigationApi::InterfaceName() const {}

void NavigationApi::AddedEventListener(
    const AtomicString& event_type,
    RegisteredEventListener& registered_listener) {}

void NavigationApi::RemovedEventListener(
    const AtomicString& event_type,
    const RegisteredEventListener& registered_listener) {}

void NavigationApi::Trace(Visitor* visitor) const {}

}  // namespace blink