chromium/third_party/blink/renderer/core/frame/web_local_frame_impl.cc

/*
 * Copyright (C) 2009 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

// How ownership works
// -------------------
//
// Big oh represents a refcounted relationship: owner O--- ownee
//
// WebView (for the toplevel frame only)
//    O
//    |           WebFrame
//    |              O
//    |              |
//   Page O------- LocalFrame (main_frame_) O-------O LocalFrameView
//                   ||
//                   ||
//               FrameLoader
//
// FrameLoader and LocalFrame are formerly one object that was split apart
// because it got too big. They basically have the same lifetime, hence the
// double line.
//
// From the perspective of the embedder, WebFrame is simply an object that it
// allocates by calling WebFrame::create() and must be freed by calling close().
// Internally, WebFrame is actually refcounted and it holds a reference to its
// corresponding LocalFrame in blink.
//
// Oilpan: the middle objects + Page in the above diagram are Oilpan heap
// allocated, WebView and LocalFrameView are currently not. In terms of
// ownership and control, the relationships stays the same, but the references
// from the off-heap WebView to the on-heap Page is handled by a Persistent<>,
// not a scoped_refptr<>. Similarly, the mutual strong references between the
// on-heap LocalFrame and the off-heap LocalFrameView is through a RefPtr (from
// LocalFrame to LocalFrameView), and a Persistent refers to the LocalFrame in
// the other direction.
//
// From the embedder's point of view, the use of Oilpan brings no changes.
// close() must still be used to signal that the embedder is through with the
// WebFrame.  Calling it will bring about the release and finalization of the
// frame object, and everything underneath.
//
// How frames are destroyed
// ------------------------
//
// The main frame is never destroyed and is re-used. The FrameLoader is re-used
// and a reference to the main frame is kept by the Page.
//
// When frame content is replaced, all subframes are destroyed. This happens
// in Frame::detachChildren for each subframe in a pre-order depth-first
// traversal. Note that child node order may not match DOM node order!
// detachChildren() (virtually) calls Frame::detach(), which again calls
// LocalFrameClient::detached(). This triggers WebFrame to clear its reference
// to LocalFrame. LocalFrameClient::detached() also notifies the embedder via
// WebLocalFrameClient that the frame is detached. Most embedders will invoke
// close() on the WebFrame at this point, triggering its deletion unless
// something else is still retaining a reference.
//
// The client is expected to be set whenever the WebLocalFrameImpl is attached
// to the DOM.

#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"

#include <algorithm>
#include <cmath>
#include <memory>
#include <numeric>
#include <utility>

#include "base/compiler_specific.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "cc/base/features.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/cpp/web_sandbox_flags.h"
#include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h"
#include "third_party/blink/public/common/context_menu_data/context_menu_params_builder.h"
#include "third_party/blink/public/common/frame/fenced_frame_sandbox_flags.h"
#include "third_party/blink/public/common/page_state/page_state.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/browser_interface_broker.mojom-blink.h"
#include "third_party/blink/public/mojom/devtools/inspector_issue.mojom-blink.h"
#include "third_party/blink/public/mojom/fenced_frame/fenced_frame.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/frame_replication_state.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/media_player_action.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/tree_scope_type.mojom-blink.h"
#include "third_party/blink/public/mojom/lcp_critical_path_predictor/lcp_critical_path_predictor.mojom.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
#include "third_party/blink/public/platform/interface_registry.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_isolated_world_info.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_associated_url_loader_options.h"
#include "third_party/blink/public/web/web_autofill_client.h"
#include "third_party/blink/public/web/web_console_message.h"
#include "third_party/blink/public/web/web_content_capture_client.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_form_element.h"
#include "third_party/blink/public/web/web_frame_owner_properties.h"
#include "third_party/blink/public/web/web_history_item.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_local_frame_client.h"
#include "third_party/blink/public/web/web_manifest_manager.h"
#include "third_party/blink/public/web/web_navigation_params.h"
#include "third_party/blink/public/web/web_node.h"
#include "third_party/blink/public/web/web_performance_metrics_for_nested_contexts.h"
#include "third_party/blink/public/web/web_performance_metrics_for_reporting.h"
#include "third_party/blink/public/web/web_plugin.h"
#include "third_party/blink/public/web/web_print_client.h"
#include "third_party/blink/public/web/web_print_page_description.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "third_party/blink/public/web/web_print_preset_options.h"
#include "third_party/blink/public/web/web_range.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_serialized_script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/binding_security.h"
#include "third_party/blink/renderer/bindings/core/v8/isolated_world_csp.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_utilities.h"
#include "third_party/blink/renderer/core/clipboard/system_clipboard.h"
#include "third_party/blink/renderer/core/core_initializer.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/events/add_event_listener_options_resolved.h"
#include "third_party/blink/renderer/core/dom/icon_url.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/finder/find_in_page_coordinates.h"
#include "third_party/blink/renderer/core/editing/finder/text_finder.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/ime/edit_context.h"
#include "third_party/blink/renderer/core/editing/ime/ime_text_span_vector_builder.h"
#include "third_party/blink/renderer/core/editing/ime/input_method_controller.h"
#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h"
#include "third_party/blink/renderer/core/editing/plain_text_range.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/editing/set_selection_options.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h"
#include "third_party/blink/renderer/core/editing/text_affinity.h"
#include "third_party/blink/renderer/core/editing/visible_position.h"
#include "third_party/blink/renderer/core/events/after_print_event.h"
#include "third_party/blink/renderer/core/events/before_print_event.h"
#include "third_party/blink/renderer/core/events/touch_event.h"
#include "third_party/blink/renderer/core/execution_context/window_agent.h"
#include "third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.h"
#include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h"
#include "third_party/blink/renderer/core/exported/web_view_impl.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/deprecation/deprecation.h"
#include "third_party/blink/renderer/core/frame/find_in_page.h"
#include "third_party/blink/renderer/core/frame/frame_console.h"
#include "third_party/blink/renderer/core/frame/intervention.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame_client_impl.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/page_scale_constraints_set.h"
#include "third_party/blink/renderer/core/frame/pausable_script_executor.h"
#include "third_party/blink/renderer/core/frame/remote_frame.h"
#include "third_party/blink/renderer/core/frame/remote_frame_owner.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/smart_clip.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/frame/web_frame_widget_impl.h"
#include "third_party/blink/renderer/core/frame/web_remote_frame_impl.h"
#include "third_party/blink/renderer/core/html/fenced_frame/html_fenced_frame_element.h"
#include "third_party/blink/renderer/core/html/forms/html_form_control_element.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/html_anchor_element.h"
#include "third_party/blink/renderer/core/html/html_collection.h"
#include "third_party/blink/renderer/core/html/html_frame_element_base.h"
#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/html/html_head_element.h"
#include "third_party/blink/renderer/core/html/html_iframe_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/html/html_link_element.h"
#include "third_party/blink/renderer/core/html/plugin_document.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/input/context_menu_allowed_scope.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/inspector_audits_issue.h"
#include "third_party/blink/renderer/core/inspector/inspector_issue.h"
#include "third_party/blink/renderer/core/inspector/inspector_issue_conversion.h"
#include "third_party/blink/renderer/core/layout/hit_test_result.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/lcp_critical_path_predictor/lcp_critical_path_predictor.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/loader/frame_loader.h"
#include "third_party/blink/renderer/core/loader/history_item.h"
#include "third_party/blink/renderer/core/loader/web_associated_url_loader_impl.h"
#include "third_party/blink/renderer/core/page/context_menu_controller.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/frame_tree.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/print_context.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/scroll/scroll_types.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/timing/dom_window_performance.h"
#include "third_party/blink/renderer/core/timing/window_performance.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h"
#include "third_party/blink/renderer/platform/graphics/paint/ignore_paint_timing_scope.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
#include "third_party/blink/renderer/platform/graphics/paint/scoped_paint_chunk_properties.h"
#include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_context.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader_factory.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h"
#include "third_party/blink/renderer/platform/text/text_direction.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/renderer/platform/weborigin/security_policy.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "ui/gfx/geometry/size_conversions.h"

#if BUILDFLAG(IS_WIN)
#include "third_party/blink/public/web/win/web_font_family_names.h"
#include "third_party/blink/renderer/core/layout/layout_font_accessor_win.h"
#endif

namespace blink {

namespace {

int g_frame_count =;

class DummyFrameOwner final : public GarbageCollected<DummyFrameOwner>,
                              public FrameOwner {};

}  // namespace

// Simple class to override some of PrintContext behavior. Some of the methods
// made virtual so that they can be overridden by ChromePluginPrintContext.
class ChromePrintContext : public PrintContext {};

// Simple class to override some of PrintContext behavior. This is used when
// the frame hosts a plugin that supports custom printing. In this case, we
// want to delegate all printing related calls to the plugin.
class ChromePluginPrintContext final : public ChromePrintContext {};

class PaintPreviewContext : public PrintContext {};

// Android WebView requires hit testing results on every touch event. This
// pushes the hit test result to the callback that is registered.
class TouchStartEventListener : public NativeEventListener {};

// WebFrame -------------------------------------------------------------------

static CreateWebFrameWidgetCallback* g_create_web_frame_widget =;

void InstallCreateWebFrameWidgetHook(
    CreateWebFrameWidgetCallback* create_widget) {}

WebFrameWidget* WebLocalFrame::InitializeFrameWidget(
    CrossVariantMojoAssociatedRemote<mojom::blink::FrameWidgetHostInterfaceBase>
        mojo_frame_widget_host,
    CrossVariantMojoAssociatedReceiver<mojom::blink::FrameWidgetInterfaceBase>
        mojo_frame_widget,
    CrossVariantMojoAssociatedRemote<mojom::blink::WidgetHostInterfaceBase>
        mojo_widget_host,
    CrossVariantMojoAssociatedReceiver<mojom::blink::WidgetInterfaceBase>
        mojo_widget,
    const viz::FrameSinkId& frame_sink_id,
    bool is_for_nested_main_frame,
    bool is_for_scalable_page,
    bool hidden) {}

int WebFrame::InstanceCount() {}

// static
WebFrame* WebFrame::FromFrameToken(const FrameToken& frame_token) {}

// static
WebLocalFrame* WebLocalFrame::FromFrameToken(
    const LocalFrameToken& frame_token) {}

WebLocalFrame* WebLocalFrame::FrameForCurrentContext() {}

void WebLocalFrameImpl::NotifyUserActivation(
    mojom::blink::UserActivationNotificationType notification_type) {}

bool WebLocalFrameImpl::HasStickyUserActivation() {}

bool WebLocalFrameImpl::HasTransientUserActivation() {}

bool WebLocalFrameImpl::ConsumeTransientUserActivation(
    UserActivationUpdateSource update_source) {}

bool WebLocalFrameImpl::LastActivationWasRestricted() const {}

#if BUILDFLAG(IS_WIN)
WebFontFamilyNames WebLocalFrameImpl::GetWebFontFamilyNames() const {
  FontFamilyNames font_family_names;
  GetFontsUsedByFrame(*GetFrame(), font_family_names);
  WebFontFamilyNames result;
  for (const String& font_family_name : font_family_names.font_names) {
    result.font_names.push_back(font_family_name);
  }
  return result;
}
#endif

WebLocalFrame* WebLocalFrame::FrameForContext(v8::Local<v8::Context> context) {}

bool WebLocalFrameImpl::IsWebLocalFrame() const {}

WebLocalFrame* WebLocalFrameImpl::ToWebLocalFrame() {}

const WebLocalFrame* WebLocalFrameImpl::ToWebLocalFrame() const {}

bool WebLocalFrameImpl::IsWebRemoteFrame() const {}

WebRemoteFrame* WebLocalFrameImpl::ToWebRemoteFrame() {}

const WebRemoteFrame* WebLocalFrameImpl::ToWebRemoteFrame() const {}

void WebLocalFrameImpl::Close() {}

WebString WebLocalFrameImpl::AssignedName() const {}

ui::AXTreeID WebLocalFrameImpl::GetAXTreeID() const {}

void WebLocalFrameImpl::SetName(const WebString& name) {}

WebContentSettingsClient* WebLocalFrameImpl::GetContentSettingsClient() const {}

void WebLocalFrameImpl::SetContentSettingsClient(
    WebContentSettingsClient* client) {}

ScrollableArea* WebLocalFrameImpl::LayoutViewport() const {}

bool WebLocalFrameImpl::IsFocused() const {}

bool WebLocalFrameImpl::DispatchedPagehideAndStillHidden() const {}

void WebLocalFrameImpl::CopyToFindPboard() {}

void WebLocalFrameImpl::CenterSelection() {}

gfx::PointF WebLocalFrameImpl::GetScrollOffset() const {}

void WebLocalFrameImpl::SetScrollOffset(const gfx::PointF& offset) {}

gfx::Size WebLocalFrameImpl::DocumentSize() const {}

bool WebLocalFrameImpl::HasVisibleContent() const {}

gfx::Rect WebLocalFrameImpl::VisibleContentRect() const {}

WebView* WebLocalFrameImpl::View() const {}

BrowserInterfaceBrokerProxy& WebLocalFrameImpl::GetBrowserInterfaceBroker() {}

WebDocument WebLocalFrameImpl::GetDocument() const {}

WebPerformanceMetricsForReporting
WebLocalFrameImpl::PerformanceMetricsForReporting() const {}

WebPerformanceMetricsForNestedContexts
WebLocalFrameImpl::PerformanceMetricsForNestedContexts() const {}

bool WebLocalFrameImpl::IsAdFrame() const {}

bool WebLocalFrameImpl::IsAdScriptInStack() const {}

void WebLocalFrameImpl::SetAdEvidence(
    const blink::FrameAdEvidence& ad_evidence) {}

const std::optional<blink::FrameAdEvidence>& WebLocalFrameImpl::AdEvidence() {}

bool WebLocalFrameImpl::IsFrameCreatedByAdScript() {}

void WebLocalFrameImpl::ExecuteScript(const WebScriptSource& source) {}

void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld(
    int32_t world_id,
    const WebScriptSource& source_in,
    BackForwardCacheAware back_forward_cache_aware) {}

v8::Local<v8::Value>
WebLocalFrameImpl::ExecuteScriptInIsolatedWorldAndReturnValue(
    int32_t world_id,
    const WebScriptSource& source_in,
    BackForwardCacheAware back_forward_cache_aware) {}

void WebLocalFrameImpl::ClearIsolatedWorldCSPForTesting(int32_t world_id) {}

void WebLocalFrameImpl::Alert(const WebString& message) {}

bool WebLocalFrameImpl::Confirm(const WebString& message) {}

WebString WebLocalFrameImpl::Prompt(const WebString& message,
                                    const WebString& default_value) {}

void WebLocalFrameImpl::GenerateInterventionReport(const WebString& message_id,
                                                   const WebString& message) {}

void WebLocalFrameImpl::CollectGarbageForTesting() {}

v8::MaybeLocal<v8::Value> WebLocalFrameImpl::ExecuteMethodAndReturnValue(
    v8::Local<v8::Function> function,
    v8::Local<v8::Value> receiver,
    int argc,
    v8::Local<v8::Value> argv[]) {}

v8::Local<v8::Value> WebLocalFrameImpl::ExecuteScriptAndReturnValue(
    const WebScriptSource& source) {}

void WebLocalFrameImpl::RequestExecuteV8Function(
    v8::Local<v8::Context> context,
    v8::Local<v8::Function> function,
    v8::Local<v8::Value> receiver,
    int argc,
    v8::Local<v8::Value> argv[],
    WebScriptExecutionCallback callback) {}

void WebLocalFrameImpl::RequestExecuteScript(
    int32_t world_id,
    base::span<const WebScriptSource> sources,
    mojom::blink::UserActivationOption user_gesture,
    mojom::blink::EvaluationTiming evaluation_timing,
    mojom::blink::LoadEventBlockingOption blocking_option,
    WebScriptExecutionCallback callback,
    BackForwardCacheAware back_forward_cache_aware,
    mojom::blink::WantResultOption want_result_option,
    mojom::blink::PromiseResultOption promise_behavior) {}

bool WebLocalFrameImpl::IsInspectorConnected() {}

v8::MaybeLocal<v8::Value> WebLocalFrameImpl::CallFunctionEvenIfScriptDisabled(
    v8::Local<v8::Function> function,
    v8::Local<v8::Value> receiver,
    int argc,
    v8::Local<v8::Value> argv[]) {}

v8::Local<v8::Context> WebLocalFrameImpl::MainWorldScriptContext() const {}

int32_t WebLocalFrameImpl::GetScriptContextWorldId(
    v8::Local<v8::Context> script_context) const {}

v8::Local<v8::Context> WebLocalFrameImpl::GetScriptContextFromWorldId(
    v8::Isolate* isolate,
    int world_id) const {}

v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy(
    v8::Isolate* isolate) const {}

bool WebFrame::ScriptCanAccess(v8::Isolate* isolate, WebFrame* target) {}

void WebLocalFrameImpl::StartReload(WebFrameLoadType frame_load_type) {}

void WebLocalFrameImpl::ReloadImage(const WebNode& web_node) {}

void WebLocalFrameImpl::ClearActiveFindMatchForTesting() {}

WebDocumentLoader* WebLocalFrameImpl::GetDocumentLoader() const {}

void WebLocalFrameImpl::EnableViewSourceMode(bool enable) {}

bool WebLocalFrameImpl::IsViewSourceModeEnabled() const {}

void WebLocalFrameImpl::SetReferrerForRequest(WebURLRequest& request,
                                              const WebURL& referrer_url) {}

std::unique_ptr<WebAssociatedURLLoader>
WebLocalFrameImpl::CreateAssociatedURLLoader(
    const WebAssociatedURLLoaderOptions& options) {}

void WebLocalFrameImpl::DeprecatedStopLoading() {}

void WebLocalFrameImpl::ReplaceSelection(const WebString& text) {}

void WebLocalFrameImpl::UnmarkText() {}

bool WebLocalFrameImpl::HasMarkedText() const {}

WebRange WebLocalFrameImpl::MarkedRange() const {}

bool WebLocalFrameImpl::FirstRectForCharacterRange(
    uint32_t location,
    uint32_t length,
    gfx::Rect& rect_in_viewport) const {}

bool WebLocalFrameImpl::ExecuteCommand(const WebString& name) {}

bool WebLocalFrameImpl::ExecuteCommand(const WebString& name,
                                       const WebString& value) {}

bool WebLocalFrameImpl::IsCommandEnabled(const WebString& name) const {}

bool WebLocalFrameImpl::SelectionTextDirection(
    base::i18n::TextDirection& start,
    base::i18n::TextDirection& end) const {}

bool WebLocalFrameImpl::IsSelectionAnchorFirst() const {}

void WebLocalFrameImpl::SetTextDirectionForTesting(
    base::i18n::TextDirection direction) {}

void WebLocalFrameImpl::ReplaceMisspelledRange(const WebString& text) {}

void WebLocalFrameImpl::RemoveSpellingMarkers() {}

void WebLocalFrameImpl::RemoveSpellingMarkersUnderWords(
    const WebVector<WebString>& words) {}

bool WebLocalFrameImpl::HasSelection() const {}

WebRange WebLocalFrameImpl::SelectionRange() const {}

WebString WebLocalFrameImpl::SelectionAsText() const {}

WebString WebLocalFrameImpl::SelectionAsMarkup() const {}

void WebLocalFrameImpl::TextSelectionChanged(const WebString& selection_text,
                                             uint32_t offset,
                                             const gfx::Range& range) {}

bool WebLocalFrameImpl::SelectAroundCaret(
    mojom::blink::SelectionGranularity granularity,
    bool should_show_handle,
    bool should_show_context_menu) {}

EphemeralRange WebLocalFrameImpl::GetWordSelectionRangeAroundCaret() const {}

void WebLocalFrameImpl::SelectRange(const gfx::Point& base_in_viewport,
                                    const gfx::Point& extent_in_viewport) {}

void WebLocalFrameImpl::SelectRange(
    const WebRange& web_range,
    HandleVisibilityBehavior handle_visibility_behavior,
    blink::mojom::SelectionMenuBehavior selection_menu_behavior,
    SelectionSetFocusBehavior selection_set_focus_behavior) {}

WebString WebLocalFrameImpl::RangeAsText(const WebRange& web_range) {}

void WebLocalFrameImpl::MoveRangeSelectionExtent(const gfx::Point& point) {}

void WebLocalFrameImpl::MoveRangeSelection(
    const gfx::Point& base_in_viewport,
    const gfx::Point& extent_in_viewport,
    WebFrame::TextGranularity granularity) {}

void WebLocalFrameImpl::MoveCaretSelection(
    const gfx::Point& point_in_viewport) {}

bool WebLocalFrameImpl::SetEditableSelectionOffsets(int start, int end) {}

bool WebLocalFrameImpl::AddImeTextSpansToExistingText(
    const WebVector<ui::ImeTextSpan>& ime_text_spans,
    unsigned text_start,
    unsigned text_end) {}
bool WebLocalFrameImpl::ClearImeTextSpansByType(ui::ImeTextSpan::Type type,
                                                unsigned text_start,
                                                unsigned text_end) {}

bool WebLocalFrameImpl::SetCompositionFromExistingText(
    int composition_start,
    int composition_end,
    const WebVector<ui::ImeTextSpan>& ime_text_spans) {}

void WebLocalFrameImpl::ExtendSelectionAndDelete(int before, int after) {}

void WebLocalFrameImpl::ExtendSelectionAndReplace(
    int before,
    int after,
    const WebString& replacement_text) {}

void WebLocalFrameImpl::DeleteSurroundingText(int before, int after) {}

void WebLocalFrameImpl::DeleteSurroundingTextInCodePoints(int before,
                                                          int after) {}

WebPlugin* WebLocalFrameImpl::FocusedPluginIfInputMethodSupported() {}

void WebLocalFrameImpl::DispatchBeforePrintEvent(
    base::WeakPtr<WebPrintClient> print_client) {}

void WebLocalFrameImpl::DispatchAfterPrintEvent() {}

void WebLocalFrameImpl::DispatchPrintEventRecursively(
    const AtomicString& event_type) {}

WebPluginContainerImpl* WebLocalFrameImpl::GetPluginToPrintHelper(
    const WebNode& constrain_to_node) {}

WebPlugin* WebLocalFrameImpl::GetPluginToPrint(
    const WebNode& constrain_to_node) {}

bool WebLocalFrameImpl::WillPrintSoon() {}

uint32_t WebLocalFrameImpl::PrintBegin(const WebPrintParams& print_params,
                                       const WebNode& constrain_to_node) {}

void WebLocalFrameImpl::PrintPage(uint32_t page_index,
                                  cc::PaintCanvas* canvas) {}

void WebLocalFrameImpl::PrintEnd() {}

bool WebLocalFrameImpl::GetPrintPresetOptionsForPlugin(
    const WebNode& node,
    WebPrintPresetOptions* preset_options) {}

bool WebLocalFrameImpl::CapturePaintPreview(const gfx::Rect& bounds,
                                            cc::PaintCanvas* canvas,
                                            bool include_linked_destinations,
                                            bool skip_accelerated_content) {}

WebPrintPageDescription WebLocalFrameImpl::GetPageDescription(
    uint32_t page_index) {}

gfx::Size WebLocalFrameImpl::SpoolSizeInPixelsForTesting(
    const WebVector<uint32_t>& pages) {}

gfx::Size WebLocalFrameImpl::SpoolSizeInPixelsForTesting(uint32_t page_count) {}

void WebLocalFrameImpl::PrintPagesForTesting(
    cc::PaintCanvas* canvas,
    const gfx::Size& spool_size_in_pixels,
    const WebVector<uint32_t>* pages) {}

gfx::Rect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const {}

gfx::Point WebLocalFrameImpl::GetPositionInViewportForTesting() const {}

// WebLocalFrameImpl public --------------------------------------------------

WebLocalFrame* WebLocalFrame::CreateMainFrame(
    WebView* web_view,
    WebLocalFrameClient* client,
    InterfaceRegistry* interface_registry,
    CrossVariantMojoRemote<mojom::BrowserInterfaceBrokerInterfaceBase>
        interface_broker,
    const LocalFrameToken& frame_token,
    const DocumentToken& document_token,
    std::unique_ptr<WebPolicyContainer> policy_container,
    WebFrame* opener,
    const WebString& name,
    network::mojom::blink::WebSandboxFlags sandbox_flags,
    const WebURL& creator_base_url) {}

WebLocalFrame* WebLocalFrame::CreateProvisional(
    WebLocalFrameClient* client,
    InterfaceRegistry* interface_registry,
    CrossVariantMojoRemote<mojom::BrowserInterfaceBrokerInterfaceBase>
        interface_broker,
    const LocalFrameToken& frame_token,
    WebFrame* previous_frame,
    const FramePolicy& frame_policy,
    const WebString& name,
    WebView* web_view) {}

WebLocalFrameImpl* WebLocalFrameImpl::CreateMainFrame(
    WebView* web_view,
    WebLocalFrameClient* client,
    InterfaceRegistry* interface_registry,
    mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker> interface_broker,
    const LocalFrameToken& frame_token,
    WebFrame* opener,
    const WebString& name,
    network::mojom::blink::WebSandboxFlags sandbox_flags,
    const DocumentToken& document_token,
    std::unique_ptr<WebPolicyContainer> policy_container,
    const WebURL& creator_base_url) {}

WebLocalFrameImpl* WebLocalFrameImpl::CreateProvisional(
    WebLocalFrameClient* client,
    blink::InterfaceRegistry* interface_registry,
    mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker> interface_broker,
    const LocalFrameToken& frame_token,
    WebFrame* previous_web_frame,
    const FramePolicy& frame_policy,
    const WebString& name,
    WebView* web_view) {}

WebLocalFrameImpl* WebLocalFrameImpl::CreateLocalChild(
    mojom::blink::TreeScopeType scope,
    WebLocalFrameClient* client,
    blink::InterfaceRegistry* interface_registry,
    const LocalFrameToken& frame_token) {}

WebLocalFrameImpl::WebLocalFrameImpl(
    base::PassKey<WebLocalFrameImpl>,
    mojom::blink::TreeScopeType scope,
    WebLocalFrameClient* client,
    blink::InterfaceRegistry* interface_registry,
    const LocalFrameToken& frame_token)
    :{}

WebLocalFrameImpl::WebLocalFrameImpl(base::PassKey<WebRemoteFrameImpl>,
                                     mojom::blink::TreeScopeType scope,
                                     WebLocalFrameClient* client,
                                     InterfaceRegistry* interface_registry,
                                     const LocalFrameToken& frame_token)
    :{}

WebLocalFrameImpl::~WebLocalFrameImpl() {}

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

void WebLocalFrameImpl::SetCoreFrame(LocalFrame* frame) {}

void WebLocalFrameImpl::InitializeCoreFrame(
    Page& page,
    FrameOwner* owner,
    WebFrame* parent,
    WebFrame* previous_sibling,
    FrameInsertType insert_type,
    const AtomicString& name,
    WindowAgentFactory* window_agent_factory,
    WebFrame* opener,
    const DocumentToken& document_token,
    mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker> interface_broker,
    std::unique_ptr<blink::WebPolicyContainer> policy_container,
    const StorageKey& storage_key,
    const KURL& creator_base_url,
    network::mojom::blink::WebSandboxFlags sandbox_flags) {}

void WebLocalFrameImpl::InitializeCoreFrameInternal(
    Page& page,
    FrameOwner* owner,
    WebFrame* parent,
    WebFrame* previous_sibling,
    FrameInsertType insert_type,
    const AtomicString& name,
    WindowAgentFactory* window_agent_factory,
    WebFrame* opener,
    const DocumentToken& document_token,
    mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker> interface_broker,
    std::unique_ptr<PolicyContainer> policy_container,
    const StorageKey& storage_key,
    ukm::SourceId document_ukm_source_id,
    const KURL& creator_base_url,
    network::mojom::blink::WebSandboxFlags sandbox_flags) {}

LocalFrame* WebLocalFrameImpl::CreateChildFrame(
    const AtomicString& name,
    HTMLFrameOwnerElement* owner_element) {}

RemoteFrame* WebLocalFrameImpl::CreateFencedFrame(
    HTMLFencedFrameElement* fenced_frame,
    mojo::PendingAssociatedReceiver<mojom::blink::FencedFrameOwnerHost>
        receiver) {}

void WebLocalFrameImpl::DidChangeContentsSize(const gfx::Size& size) {}

bool WebLocalFrameImpl::HasDevToolsOverlays() const {}

void WebLocalFrameImpl::UpdateDevToolsOverlaysPrePaint() {}

void WebLocalFrameImpl::PaintDevToolsOverlays(GraphicsContext& context) {}

void WebLocalFrameImpl::CreateFrameView() {}

WebLocalFrameImpl* WebLocalFrameImpl::FromFrame(LocalFrame* frame) {}

std::string WebLocalFrameImpl::GetNullFrameReasonForBug1139104(
    LocalFrame* frame) {}

WebLocalFrameImpl* WebLocalFrameImpl::FromFrame(LocalFrame& frame) {}

WebViewImpl* WebLocalFrameImpl::ViewImpl() const {}

bool WebLocalFrameImpl::ShouldWarmUpCompositorOnPrerenderFromThisPoint(
    features::Prerender2WarmUpCompositorTriggerPoint trigger_point) {}

void WebLocalFrameImpl::DidCommitLoad() {}

void WebLocalFrameImpl::DidDispatchDOMContentLoadedEvent() {}

void WebLocalFrameImpl::DidFailLoad(const ResourceError& error,
                                    WebHistoryCommitType web_commit_type) {}

void WebLocalFrameImpl::DidFinish() {}

void WebLocalFrameImpl::DidFinishLoadForPrinting() {}

HitTestResult WebLocalFrameImpl::HitTestResultForVisualViewportPos(
    const gfx::Point& pos_in_viewport) {}

void WebLocalFrameImpl::SetAutofillClient(WebAutofillClient* autofill_client) {}

WebAutofillClient* WebLocalFrameImpl::AutofillClient() {}

void WebLocalFrameImpl::SetContentCaptureClient(
    WebContentCaptureClient* content_capture_client) {}

WebContentCaptureClient* WebLocalFrameImpl::ContentCaptureClient() const {}

bool WebLocalFrameImpl::IsProvisional() const {}

WebLocalFrameImpl* WebLocalFrameImpl::LocalRoot() {}

WebFrame* WebLocalFrameImpl::FindFrameByName(const WebString& name) {}

void WebLocalFrameImpl::SetEmbeddingToken(
    const base::UnguessableToken& embedding_token) {}

bool WebLocalFrameImpl::IsInFencedFrameTree() const {}

const std::optional<base::UnguessableToken>&
WebLocalFrameImpl::GetEmbeddingToken() const {}

void WebLocalFrameImpl::SendPings(const WebURL& destination_url) {}

bool WebLocalFrameImpl::DispatchBeforeUnloadEvent(bool is_reload) {}

void WebLocalFrameImpl::CommitNavigation(
    std::unique_ptr<WebNavigationParams> navigation_params,
    std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) {}

blink::mojom::CommitResult WebLocalFrameImpl::CommitSameDocumentNavigation(
    const WebURL& url,
    WebFrameLoadType web_frame_load_type,
    const WebHistoryItem& item,
    bool is_client_redirect,
    bool has_transient_user_activation,
    const WebSecurityOrigin& initiator_origin,
    bool is_browser_initiated,
    bool has_ua_visual_transition,
    std::optional<scheduler::TaskAttributionId>
        soft_navigation_heuristics_task_id) {}

bool WebLocalFrameImpl::IsLoading() const {}

bool WebLocalFrameImpl::IsNavigationScheduledWithin(
    base::TimeDelta interval) const {}

void WebLocalFrameImpl::SetIsNotOnInitialEmptyDocument() {}

bool WebLocalFrameImpl::IsOnInitialEmptyDocument() {}

void WebLocalFrameImpl::BlinkFeatureUsageReport(
    blink::mojom::WebFeature feature) {}

void WebLocalFrameImpl::DidDropNavigation() {}

void WebLocalFrameImpl::DownloadURL(
    const WebURLRequest& request,
    network::mojom::blink::RedirectMode cross_origin_redirect_behavior,
    CrossVariantMojoRemote<mojom::blink::BlobURLTokenInterfaceBase>
        blob_url_token) {}

void WebLocalFrameImpl::MaybeStartOutermostMainFrameNavigation(
    const WebVector<WebURL>& urls) const {}

bool WebLocalFrameImpl::WillStartNavigation(const WebNavigationInfo& info) {}

void WebLocalFrameImpl::SendOrientationChangeEvent() {}

WebNode WebLocalFrameImpl::ContextMenuNode() const {}

WebNode WebLocalFrameImpl::ContextMenuImageNode() const {}

void WebLocalFrameImpl::WillBeDetached() {}

void WebLocalFrameImpl::WillDetachParent() {}

void WebLocalFrameImpl::CreateFrameWidgetInternal(
    base::PassKey<WebLocalFrame> pass_key,
    CrossVariantMojoAssociatedRemote<mojom::blink::FrameWidgetHostInterfaceBase>
        mojo_frame_widget_host,
    CrossVariantMojoAssociatedReceiver<mojom::blink::FrameWidgetInterfaceBase>
        mojo_frame_widget,
    CrossVariantMojoAssociatedRemote<mojom::blink::WidgetHostInterfaceBase>
        mojo_widget_host,
    CrossVariantMojoAssociatedReceiver<mojom::blink::WidgetInterfaceBase>
        mojo_widget,
    const viz::FrameSinkId& frame_sink_id,
    bool is_for_nested_main_frame,
    bool is_for_scalable_page,
    bool hidden) {}

WebFrameWidget* WebLocalFrameImpl::FrameWidget() const {}

void WebLocalFrameImpl::CopyImageAtForTesting(
    const gfx::Point& pos_in_viewport) {}

void WebLocalFrameImpl::ShowContextMenuFromExternal(
    const UntrustworthyContextMenuParams& params,
    CrossVariantMojoAssociatedRemote<
        mojom::blink::ContextMenuClientInterfaceBase> context_menu_client) {}

void WebLocalFrameImpl::ShowContextMenu(
    mojo::PendingAssociatedRemote<mojom::blink::ContextMenuClient> client,
    const blink::ContextMenuData& data,
    const std::optional<gfx::Point>& host_context_menu_location) {}

bool WebLocalFrameImpl::IsAllowedToDownload() const {}

bool WebLocalFrameImpl::IsCrossOriginToOutermostMainFrame() const {}

void WebLocalFrameImpl::UsageCountChromeLoadTimes(const WebString& metric) {}

void WebLocalFrameImpl::UsageCountChromeCSI(const WebString& metric) {}

FrameScheduler* WebLocalFrameImpl::Scheduler() const {}

scheduler::WebAgentGroupScheduler* WebLocalFrameImpl::GetAgentGroupScheduler()
    const {}

scoped_refptr<base::SingleThreadTaskRunner> WebLocalFrameImpl::GetTaskRunner(
    TaskType task_type) {}

WebInputMethodController* WebLocalFrameImpl::GetInputMethodController() {}

bool WebLocalFrameImpl::ShouldSuppressKeyboardForFocusedElement() {}

void WebLocalFrameImpl::AddMessageToConsoleImpl(
    const WebConsoleMessage& message,
    bool discard_duplicates) {}

// This is only triggered by test_runner.cc
void WebLocalFrameImpl::AddInspectorIssueImpl(
    mojom::blink::InspectorIssueCode code) {}

void WebLocalFrameImpl::AddGenericIssueImpl(
    mojom::blink::GenericIssueErrorType error_type,
    int violating_node_id) {}

void WebLocalFrameImpl::AddGenericIssueImpl(
    mojom::blink::GenericIssueErrorType error_type,
    int violating_node_id,
    const WebString& violating_node_attribute) {}

void WebLocalFrameImpl::SetTextCheckClient(
    WebTextCheckClient* text_check_client) {}

void WebLocalFrameImpl::SetSpellCheckPanelHostClient(
    WebSpellCheckPanelHostClient* spell_check_panel_host_client) {}

WebFrameWidgetImpl* WebLocalFrameImpl::LocalRootFrameWidget() {}

Node* WebLocalFrameImpl::ContextMenuNodeInner() const {}

Node* WebLocalFrameImpl::ContextMenuImageNodeInner() const {}

void WebLocalFrameImpl::WaitForDebuggerWhenShown() {}

WebDevToolsAgentImpl* WebLocalFrameImpl::DevToolsAgentImpl(
    bool create_if_necessary) {}

void WebLocalFrameImpl::WasHidden() {}

void WebLocalFrameImpl::WasShown() {}

void WebLocalFrameImpl::SetAllowsCrossBrowsingInstanceFrameLookup() {}

WebHistoryItem WebLocalFrameImpl::GetCurrentHistoryItem() const {}

void WebLocalFrameImpl::SetLocalStorageArea(
    CrossVariantMojoRemote<mojom::StorageAreaInterfaceBase>
        local_storage_area) {}

void WebLocalFrameImpl::SetSessionStorageArea(
    CrossVariantMojoRemote<mojom::StorageAreaInterfaceBase>
        session_storage_area) {}

void WebLocalFrameImpl::SetNotRestoredReasons(
    const mojom::BackForwardCacheNotRestoredReasonsPtr& not_restored_reasons) {}

const mojom::blink::BackForwardCacheNotRestoredReasonsPtr&
WebLocalFrameImpl::GetNotRestoredReasons() {}

mojom::blink::BackForwardCacheNotRestoredReasonsPtr
WebLocalFrameImpl::ConvertNotRestoredReasons(
    const mojom::BackForwardCacheNotRestoredReasonsPtr& reasons_to_copy) {}

void WebLocalFrameImpl::SetLCPPHint(
    const mojom::LCPCriticalPathPredictorNavigationTimeHintPtr& hint) {}

void WebLocalFrameImpl::AddHitTestOnTouchStartCallback(
    base::RepeatingCallback<void(const blink::WebHitTestResult&)> callback) {}

void WebLocalFrameImpl::BlockParserForTesting() {}

void WebLocalFrameImpl::ResumeParserForTesting() {}

void WebLocalFrameImpl::FlushInputForTesting(base::OnceClosure done_callback) {}

void WebLocalFrameImpl::SetTargetToCurrentHistoryItem(const WebString& target) {}

void WebLocalFrameImpl::UpdateCurrentHistoryItem() {}

PageState WebLocalFrameImpl::CurrentHistoryItemToPageState() {}

void WebLocalFrameImpl::ScrollFocusedEditableElementIntoView() {}

void WebLocalFrameImpl::ResetHasScrolledFocusedEditableIntoView() {}

void WebLocalFrameImpl::AddObserver(WebLocalFrameObserver* observer) {}

void WebLocalFrameImpl::RemoveObserver(WebLocalFrameObserver* observer) {}

void WebLocalFrameImpl::WillSendSubmitEvent(const WebFormElement& form) {}

bool WebLocalFrameImpl::AllowStorageAccessSyncAndNotify(
    WebContentSettingsClient::StorageType storage_type) {}

}  // namespace blink