chromium/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc

/*
 * Copyright (C) 2013 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.
 */

#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h"

#include <memory>
#include <utility>

#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/network/public/cpp/cross_origin_embedder_policy.h"
#include "services/network/public/mojom/cookie_manager.mojom-blink.h"
#include "services/network/public/mojom/cross_origin_embedder_policy.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom-blink.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/mojom/notifications/notification.mojom-blink.h"
#include "third_party/blink/public/mojom/push_messaging/push_messaging.mojom-blink.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom-blink.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom-blink.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/public/mojom/worker/subresource_loader_updater.mojom.h"
#include "third_party/blink/public/platform/modules/service_worker/web_service_worker_error.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_v8_value_converter.h"
#include "third_party/blink/renderer/bindings/core/v8/callback_promise_adapter.h"
#include "third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_background_fetch_event_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_content_index_event_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_notification_event_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_payment_request_event_init.h"
#include "third_party/blink/renderer/core/core_initializer.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/fetch/global_fetch.h"
#include "third_party/blink/renderer/core/frame/reporting_context.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/request_debug_header_scope.h"
#include "third_party/blink/renderer/core/inspector/worker_inspector_controller.h"
#include "third_party/blink/renderer/core/inspector/worker_thread_debugger.h"
#include "third_party/blink/renderer/core/loader/threadable_loader.h"
#include "third_party/blink/renderer/core/loader/worker_resource_timing_notifier_impl.h"
#include "third_party/blink/renderer/core/messaging/blink_transferable_message.h"
#include "third_party/blink/renderer/core/messaging/message_port.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_script_url.h"
#include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"
#include "third_party/blink/renderer/core/workers/worker_backing_thread.h"
#include "third_party/blink/renderer/core/workers/worker_classic_script_loader.h"
#include "third_party/blink/renderer/core/workers/worker_clients.h"
#include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h"
#include "third_party/blink/renderer/modules/background_fetch/background_fetch_event.h"
#include "third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h"
#include "third_party/blink/renderer/modules/background_fetch/background_fetch_update_ui_event.h"
#include "third_party/blink/renderer/modules/background_sync/periodic_sync_event.h"
#include "third_party/blink/renderer/modules/background_sync/sync_event.h"
#include "third_party/blink/renderer/modules/content_index/content_index_event.h"
#include "third_party/blink/renderer/modules/cookie_store/cookie_change_event.h"
#include "third_party/blink/renderer/modules/cookie_store/extendable_cookie_change_event.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/hid/hid.h"
#include "third_party/blink/renderer/modules/notifications/notification.h"
#include "third_party/blink/renderer/modules/notifications/notification_event.h"
#include "third_party/blink/renderer/modules/payments/abort_payment_event.h"
#include "third_party/blink/renderer/modules/payments/abort_payment_respond_with_observer.h"
#include "third_party/blink/renderer/modules/payments/can_make_payment_event.h"
#include "third_party/blink/renderer/modules/payments/can_make_payment_respond_with_observer.h"
#include "third_party/blink/renderer/modules/payments/payment_event_data_conversion.h"
#include "third_party/blink/renderer/modules/payments/payment_request_event.h"
#include "third_party/blink/renderer/modules/payments/payment_request_respond_with_observer.h"
#include "third_party/blink/renderer/modules/push_messaging/push_event.h"
#include "third_party/blink/renderer/modules/push_messaging/push_message_data.h"
#include "third_party/blink/renderer/modules/push_messaging/push_subscription_change_event.h"
#include "third_party/blink/renderer/modules/service_worker/cross_origin_resource_policy_checker.h"
#include "third_party/blink/renderer/modules/service_worker/extendable_event.h"
#include "third_party/blink/renderer/modules/service_worker/extendable_message_event.h"
#include "third_party/blink/renderer/modules/service_worker/fetch_event.h"
#include "third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.h"
#include "third_party/blink/renderer/modules/service_worker/install_event.h"
#include "third_party/blink/renderer/modules/service_worker/respond_with_observer.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_client.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_clients.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_module_tree_client.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_thread.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_window_client.h"
#include "third_party/blink/renderer/modules/service_worker/wait_until_observer.h"
#include "third_party/blink/renderer/modules/service_worker/web_service_worker_fetch_context_impl.h"
#include "third_party/blink/renderer/modules/webusb/usb.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h"
#include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/loader/fetch/unique_identifier.h"
#include "third_party/blink/renderer/platform/network/content_security_policy_response_headers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_policy.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"

namespace blink {

namespace {

constexpr char kServiceWorkerGlobalScopeTraceScope[] =;

// The default timeout for offline events in a service worker. The  value is
// the same as the update interval value in the event queue.
constexpr int kDefaultTimeoutSecondsForOfflineEvent =;

void DidSkipWaiting(ScriptPromiseResolver<IDLUndefined>* resolver,
                    bool success) {}

// Creates a callback which takes an |event_id| and |status|, which calls the
// given event's callback with the given status and removes it from |map|.
template <typename MapType, typename... Args>
ServiceWorkerEventQueue::AbortCallback CreateAbortCallback(MapType* map,
                                                           Args&&... args) {}

// Finds an event callback keyed by |event_id| from |map|, and runs the callback
// with |args|. Returns true if the callback was found and called, otherwise
// returns false.
template <typename MapType, typename... Args>
bool RunEventCallback(MapType* map,
                      ServiceWorkerEventQueue* event_queue,
                      int event_id,
                      Args&&... args) {}

template <typename T>
static std::string MojoEnumToString(T mojo_enum) {}

}  // namespace

ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::Create(
    ServiceWorkerThread* thread,
    std::unique_ptr<GlobalScopeCreationParams> creation_params,
    std::unique_ptr<ServiceWorkerInstalledScriptsManager>
        installed_scripts_manager,
    mojo::PendingRemote<mojom::blink::CacheStorage> cache_storage_remote,
    base::TimeTicks time_origin,
    const ServiceWorkerToken& service_worker_token) {}

ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(
    std::unique_ptr<GlobalScopeCreationParams> creation_params,
    ServiceWorkerThread* thread,
    std::unique_ptr<ServiceWorkerInstalledScriptsManager>
        installed_scripts_manager,
    mojo::PendingRemote<mojom::blink::CacheStorage> cache_storage_remote,
    base::TimeTicks time_origin,
    const ServiceWorkerToken& service_worker_token,
    InterfaceRegistry* interface_registry)
    :{}

ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() = default;

bool ServiceWorkerGlobalScope::ShouldInstallV8Extensions() const {}

// https://w3c.github.io/ServiceWorker/#update
void ServiceWorkerGlobalScope::FetchAndRunClassicScript(
    const KURL& script_url,
    std::unique_ptr<WorkerMainScriptLoadParameters>
        worker_main_script_load_params,
    std::unique_ptr<PolicyContainer> policy_container,
    const FetchClientSettingsObjectSnapshot& outside_settings_object,
    WorkerResourceTimingNotifier& outside_resource_timing_notifier,
    const v8_inspector::V8StackTraceId& stack_id) {}

void ServiceWorkerGlobalScope::FetchAndRunModuleScript(
    const KURL& module_url_record,
    std::unique_ptr<WorkerMainScriptLoadParameters>
        worker_main_script_load_params,
    std::unique_ptr<PolicyContainer> policy_container,
    const FetchClientSettingsObjectSnapshot& outside_settings_object,
    WorkerResourceTimingNotifier& outside_resource_timing_notifier,
    network::mojom::CredentialsMode credentials_mode,
    RejectCoepUnsafeNone reject_coep_unsafe_none) {}

void ServiceWorkerGlobalScope::Dispose() {}

InstalledScriptsManager*
ServiceWorkerGlobalScope::GetInstalledScriptsManager() {}

void ServiceWorkerGlobalScope::GetAssociatedInterface(
    const String& name,
    mojo::PendingAssociatedReceiver<mojom::blink::AssociatedInterface>
        receiver) {}

void ServiceWorkerGlobalScope::DidEvaluateScript() {}

AssociatedInterfaceRegistry&
ServiceWorkerGlobalScope::GetAssociatedInterfaceRegistry() {}

void ServiceWorkerGlobalScope::DidReceiveResponseForClassicScript(
    WorkerClassicScriptLoader* classic_script_loader) {}

// https://w3c.github.io/ServiceWorker/#update
void ServiceWorkerGlobalScope::DidFetchClassicScript(
    WorkerClassicScriptLoader* classic_script_loader,
    const v8_inspector::V8StackTraceId& stack_id) {}

// https://w3c.github.io/ServiceWorker/#run-service-worker-algorithm
void ServiceWorkerGlobalScope::Initialize(
    const KURL& response_url,
    network::mojom::ReferrerPolicy response_referrer_policy,
    Vector<network::mojom::blink::ContentSecurityPolicyPtr> response_csp,
    const Vector<String>* response_origin_trial_tokens) {}

void ServiceWorkerGlobalScope::LoadAndRunInstalledClassicScript(
    const KURL& script_url,
    const v8_inspector::V8StackTraceId& stack_id) {}

// https://w3c.github.io/ServiceWorker/#run-service-worker-algorithm
void ServiceWorkerGlobalScope::RunClassicScript(
    const KURL& response_url,
    network::mojom::ReferrerPolicy response_referrer_policy,
    Vector<network::mojom::blink::ContentSecurityPolicyPtr> response_csp,
    const Vector<String>* response_origin_trial_tokens,
    const String& source_code,
    std::unique_ptr<Vector<uint8_t>> cached_meta_data,
    const v8_inspector::V8StackTraceId& stack_id) {}

ServiceWorkerClients* ServiceWorkerGlobalScope::clients() {}

ServiceWorkerRegistration* ServiceWorkerGlobalScope::registration() {}

::blink::ServiceWorker* ServiceWorkerGlobalScope::serviceWorker() {}

ScriptPromise<IDLUndefined> ServiceWorkerGlobalScope::skipWaiting(
    ScriptState* script_state) {}

void ServiceWorkerGlobalScope::BindServiceWorker(
    mojo::PendingReceiver<mojom::blink::ServiceWorker> receiver) {}

void ServiceWorkerGlobalScope::BindControllerServiceWorker(
    mojo::PendingReceiver<mojom::blink::ControllerServiceWorker> receiver) {}

void ServiceWorkerGlobalScope::OnNavigationPreloadResponse(
    int fetch_event_id,
    std::unique_ptr<WebURLResponse> response,
    mojo::ScopedDataPipeConsumerHandle data_pipe) {}

void ServiceWorkerGlobalScope::OnNavigationPreloadError(
    int fetch_event_id,
    std::unique_ptr<WebServiceWorkerError> error) {}

void ServiceWorkerGlobalScope::OnNavigationPreloadComplete(
    int fetch_event_id,
    base::TimeTicks completion_time,
    int64_t encoded_data_length,
    int64_t encoded_body_length,
    int64_t decoded_body_length) {}

std::unique_ptr<ServiceWorkerEventQueue::StayAwakeToken>
ServiceWorkerGlobalScope::CreateStayAwakeToken() {}

ServiceWorker* ServiceWorkerGlobalScope::GetOrCreateServiceWorker(
    WebServiceWorkerObjectInfo info) {}

bool ServiceWorkerGlobalScope::AddEventListenerInternal(
    const AtomicString& event_type,
    EventListener* listener,
    const AddEventListenerOptionsResolved* options) {}

bool ServiceWorkerGlobalScope::FetchClassicImportedScript(
    const KURL& script_url,
    KURL* out_response_url,
    String* out_source_code,
    std::unique_ptr<Vector<uint8_t>>* out_cached_meta_data) {}

ResourceLoadScheduler::ThrottleOptionOverride
ServiceWorkerGlobalScope::GetThrottleOptionOverride() const {}

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

void ServiceWorkerGlobalScope::DispatchExtendableEvent(
    Event* event,
    WaitUntilObserver* observer) {}

void ServiceWorkerGlobalScope::DispatchExtendableEventWithRespondWith(
    Event* event,
    WaitUntilObserver* wait_until_observer,
    RespondWithObserver* respond_with_observer) {}

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

bool ServiceWorkerGlobalScope::HasRelatedFetchEvent(
    const KURL& request_url) const {}

bool ServiceWorkerGlobalScope::HasRangeFetchEvent(
    const KURL& request_url) const {}

int ServiceWorkerGlobalScope::GetOutstandingThrottledLimit() const {}

// Note that ServiceWorkers can be for cross-origin iframes, and that it might
// look like an escape from the Permissions-Policy enforced on documents. It is
// safe however, even on platforms without OOPIF  because a ServiceWorker
// controlling a cross-origin iframe would be put in  a different process from
// the page, due to an origin mismatch in their cross-origin isolation.
// See https://crbug.com/1290224 for details.
bool ServiceWorkerGlobalScope::CrossOriginIsolatedCapability() const {}

bool ServiceWorkerGlobalScope::IsIsolatedContext() const {}

void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls) {}

CachedMetadataHandler*
ServiceWorkerGlobalScope::CreateWorkerScriptCachedMetadataHandler(
    const KURL& script_url,
    std::unique_ptr<Vector<uint8_t>> meta_data) {}

void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) {}

void ServiceWorkerGlobalScope::CountCacheStorageInstalledScript(
    uint64_t script_size,
    uint64_t script_metadata_size) {}

void ServiceWorkerGlobalScope::DidHandleInstallEvent(
    int install_event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleActivateEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleBackgroundFetchAbortEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleBackgroundFetchClickEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleBackgroundFetchFailEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleBackgroundFetchSuccessEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleExtendableMessageEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::RespondToFetchEventWithNoResponse(
    int fetch_event_id,
    FetchEvent* fetch_event,
    const KURL& request_url,
    bool range_request,
    std::optional<network::DataElementChunkedDataPipe> request_body,
    base::TimeTicks event_dispatch_time,
    base::TimeTicks respond_with_settled_time) {}
void ServiceWorkerGlobalScope::OnStreamingUploadCompletion(int fetch_event_id) {}

void ServiceWorkerGlobalScope::RespondToFetchEvent(
    int fetch_event_id,
    const KURL& request_url,
    bool range_request,
    mojom::blink::FetchAPIResponsePtr response,
    base::TimeTicks event_dispatch_time,
    base::TimeTicks respond_with_settled_time) {}

void ServiceWorkerGlobalScope::RespondToFetchEventWithResponseStream(
    int fetch_event_id,
    const KURL& request_url,
    bool range_request,
    mojom::blink::FetchAPIResponsePtr response,
    mojom::blink::ServiceWorkerStreamHandlePtr body_as_stream,
    base::TimeTicks event_dispatch_time,
    base::TimeTicks respond_with_settled_time) {}

void ServiceWorkerGlobalScope::DidHandleFetchEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleNotificationClickEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleNotificationCloseEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandlePushEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandlePushSubscriptionChangeEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleSyncEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandlePeriodicSyncEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::RespondToAbortPaymentEvent(
    int event_id,
    bool payment_aborted) {}

void ServiceWorkerGlobalScope::DidHandleAbortPaymentEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::RespondToCanMakePaymentEvent(
    int event_id,
    payments::mojom::blink::CanMakePaymentResponsePtr response) {}

void ServiceWorkerGlobalScope::DidHandleCanMakePaymentEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::RespondToPaymentRequestEvent(
    int payment_event_id,
    payments::mojom::blink::PaymentHandlerResponsePtr response) {}

void ServiceWorkerGlobalScope::DidHandlePaymentRequestEvent(
    int payment_event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleCookieChangeEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::DidHandleContentDeleteEvent(
    int event_id,
    mojom::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::SetIsInstalling(bool is_installing) {}

mojo::PendingRemote<mojom::blink::CacheStorage>
ServiceWorkerGlobalScope::TakeCacheStorage() {}

mojom::blink::ServiceWorkerHost*
ServiceWorkerGlobalScope::GetServiceWorkerHost() {}

void ServiceWorkerGlobalScope::OnBeforeStartEvent(bool is_offline_event) {}

void ServiceWorkerGlobalScope::OnIdleTimeout() {}

void ServiceWorkerGlobalScope::OnRequestedTermination(bool will_be_terminated) {}

bool ServiceWorkerGlobalScope::RequestedTermination() const {}

void ServiceWorkerGlobalScope::DispatchExtendableMessageEventInternal(
    int event_id,
    mojom::blink::ExtendableMessageEventPtr event) {}

void ServiceWorkerGlobalScope::AbortCallbackForFetchEvent(
    int event_id,
    mojom::blink::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::StartFetchEvent(
    mojom::blink::DispatchFetchEventParamsPtr params,
    base::WeakPtr<CrossOriginResourcePolicyChecker> corp_checker,
    std::optional<base::TimeTicks> created_time,
    int event_id) {}

void ServiceWorkerGlobalScope::SetFetchHandlerExistence(
    FetchHandlerExistence fetch_handler_existence) {}

void ServiceWorkerGlobalScope::DispatchFetchEventForSubresource(
    mojom::blink::DispatchFetchEventParamsPtr params,
    mojo::PendingRemote<mojom::blink::ServiceWorkerFetchResponseCallback>
        response_callback,
    DispatchFetchEventForSubresourceCallback callback) {}

void ServiceWorkerGlobalScope::Clone(
    mojo::PendingReceiver<mojom::blink::ControllerServiceWorker> receiver,
    const network::CrossOriginEmbedderPolicy& cross_origin_embedder_policy,
    mojo::PendingRemote<
        network::mojom::blink::CrossOriginEmbedderPolicyReporter>
        coep_reporter) {}

void ServiceWorkerGlobalScope::InitializeGlobalScope(
    mojo::PendingAssociatedRemote<mojom::blink::ServiceWorkerHost>
        service_worker_host,
    mojo::PendingAssociatedRemote<mojom::blink::AssociatedInterfaceProvider>
        associated_interfaces_from_browser,
    mojo::PendingAssociatedReceiver<mojom::blink::AssociatedInterfaceProvider>
        associated_interfaces_to_browser,
    mojom::blink::ServiceWorkerRegistrationObjectInfoPtr registration_info,
    mojom::blink::ServiceWorkerObjectInfoPtr service_worker_info,
    mojom::blink::FetchHandlerExistence fetch_hander_existence,
    mojo::PendingReceiver<mojom::blink::ReportingObserver>
        reporting_observer_receiver,
    mojom::blink::AncestorFrameType ancestor_frame_type,
    const blink::BlinkStorageKey& storage_key) {}

void ServiceWorkerGlobalScope::PauseEvaluation() {}

void ServiceWorkerGlobalScope::ResumeEvaluation() {}

void ServiceWorkerGlobalScope::DispatchInstallEvent(
    DispatchInstallEventCallback callback) {}

void ServiceWorkerGlobalScope::AbortInstallEvent(
    int event_id,
    mojom::blink::ServiceWorkerEventStatus status) {}

void ServiceWorkerGlobalScope::StartInstallEvent(int event_id) {}

void ServiceWorkerGlobalScope::DispatchActivateEvent(
    DispatchActivateEventCallback callback) {}

void ServiceWorkerGlobalScope::StartActivateEvent(int event_id) {}

void ServiceWorkerGlobalScope::DispatchBackgroundFetchAbortEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    DispatchBackgroundFetchAbortEventCallback callback) {}

void ServiceWorkerGlobalScope::StartBackgroundFetchAbortEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchBackgroundFetchClickEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    DispatchBackgroundFetchClickEventCallback callback) {}

void ServiceWorkerGlobalScope::StartBackgroundFetchClickEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchBackgroundFetchFailEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    DispatchBackgroundFetchFailEventCallback callback) {}

void ServiceWorkerGlobalScope::StartBackgroundFetchFailEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchBackgroundFetchSuccessEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    DispatchBackgroundFetchSuccessEventCallback callback) {}

void ServiceWorkerGlobalScope::StartBackgroundFetchSuccessEvent(
    mojom::blink::BackgroundFetchRegistrationPtr registration,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchExtendableMessageEvent(
    mojom::blink::ExtendableMessageEventPtr event,
    DispatchExtendableMessageEventCallback callback) {}

void ServiceWorkerGlobalScope::StartExtendableMessageEvent(
    mojom::blink::ExtendableMessageEventPtr event,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchFetchEventForMainResource(
    mojom::blink::DispatchFetchEventParamsPtr params,
    mojo::PendingRemote<mojom::blink::ServiceWorkerFetchResponseCallback>
        response_callback,
    DispatchFetchEventForMainResourceCallback callback) {}

void ServiceWorkerGlobalScope::DispatchNotificationClickEvent(
    const String& notification_id,
    mojom::blink::NotificationDataPtr notification_data,
    int action_index,
    const String& reply,
    DispatchNotificationClickEventCallback callback) {}

void ServiceWorkerGlobalScope::StartNotificationClickEvent(
    String notification_id,
    mojom::blink::NotificationDataPtr notification_data,
    int action_index,
    String reply,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchNotificationCloseEvent(
    const String& notification_id,
    mojom::blink::NotificationDataPtr notification_data,
    DispatchNotificationCloseEventCallback callback) {}

void ServiceWorkerGlobalScope::StartNotificationCloseEvent(
    String notification_id,
    mojom::blink::NotificationDataPtr notification_data,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchPushEvent(
    const String& payload,
    DispatchPushEventCallback callback) {}

void ServiceWorkerGlobalScope::StartPushEvent(String payload, int event_id) {}

void ServiceWorkerGlobalScope::DispatchPushSubscriptionChangeEvent(
    mojom::blink::PushSubscriptionPtr old_subscription,
    mojom::blink::PushSubscriptionPtr new_subscription,
    DispatchPushSubscriptionChangeEventCallback callback) {}

void ServiceWorkerGlobalScope::StartPushSubscriptionChangeEvent(
    mojom::blink::PushSubscriptionPtr old_subscription,
    mojom::blink::PushSubscriptionPtr new_subscription,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchSyncEvent(
    const String& tag,
    bool last_chance,
    base::TimeDelta timeout,
    DispatchSyncEventCallback callback) {}

void ServiceWorkerGlobalScope::StartSyncEvent(String tag,
                                              bool last_chance,
                                              int event_id) {}

void ServiceWorkerGlobalScope::DispatchPeriodicSyncEvent(
    const String& tag,
    base::TimeDelta timeout,
    DispatchPeriodicSyncEventCallback callback) {}

void ServiceWorkerGlobalScope::StartPeriodicSyncEvent(String tag,
                                                      int event_id) {}

void ServiceWorkerGlobalScope::DispatchAbortPaymentEvent(
    mojo::PendingRemote<payments::mojom::blink::PaymentHandlerResponseCallback>
        response_callback,
    DispatchAbortPaymentEventCallback callback) {}

void ServiceWorkerGlobalScope::StartAbortPaymentEvent(
    mojo::PendingRemote<payments::mojom::blink::PaymentHandlerResponseCallback>
        response_callback,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchCanMakePaymentEvent(
    payments::mojom::blink::CanMakePaymentEventDataPtr event_data,
    mojo::PendingRemote<payments::mojom::blink::PaymentHandlerResponseCallback>
        response_callback,
    DispatchCanMakePaymentEventCallback callback) {}

void ServiceWorkerGlobalScope::StartCanMakePaymentEvent(
    payments::mojom::blink::CanMakePaymentEventDataPtr event_data,
    mojo::PendingRemote<payments::mojom::blink::PaymentHandlerResponseCallback>
        response_callback,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchPaymentRequestEvent(
    payments::mojom::blink::PaymentRequestEventDataPtr event_data,
    mojo::PendingRemote<payments::mojom::blink::PaymentHandlerResponseCallback>
        response_callback,
    DispatchPaymentRequestEventCallback callback) {}

void ServiceWorkerGlobalScope::StartPaymentRequestEvent(
    payments::mojom::blink::PaymentRequestEventDataPtr event_data,
    mojo::PendingRemote<payments::mojom::blink::PaymentHandlerResponseCallback>
        response_callback,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchCookieChangeEvent(
    network::mojom::blink::CookieChangeInfoPtr change,
    DispatchCookieChangeEventCallback callback) {}

void ServiceWorkerGlobalScope::StartCookieChangeEvent(
    network::mojom::blink::CookieChangeInfoPtr change,
    int event_id) {}

void ServiceWorkerGlobalScope::DispatchContentDeleteEvent(
    const String& id,
    DispatchContentDeleteEventCallback callback) {}

void ServiceWorkerGlobalScope::StartContentDeleteEvent(String id,
                                                       int event_id) {}

void ServiceWorkerGlobalScope::Ping(PingCallback callback) {}

void ServiceWorkerGlobalScope::SetIdleDelay(base::TimeDelta delay) {}

void ServiceWorkerGlobalScope::AddKeepAlive() {}

void ServiceWorkerGlobalScope::ClearKeepAlive() {}

void ServiceWorkerGlobalScope::AddMessageToConsole(
    mojom::blink::ConsoleMessageLevel level,
    const String& message) {}

void ServiceWorkerGlobalScope::ExecuteScriptForTest(
    const String& javascript,
    bool wants_result,
    ExecuteScriptForTestCallback callback) {}

void ServiceWorkerGlobalScope::NoteNewFetchEvent(
    const mojom::blink::FetchAPIRequest& request) {}

void ServiceWorkerGlobalScope::NoteRespondedToFetchEvent(
    const KURL& request_url,
    bool range_request) {}

void ServiceWorkerGlobalScope::RecordQueuingTime(base::TimeTicks created_time) {}

bool ServiceWorkerGlobalScope::IsInFencedFrame() const {}

void ServiceWorkerGlobalScope::NotifyWebSocketActivity() {}

mojom::blink::ServiceWorkerFetchHandlerType
ServiceWorkerGlobalScope::FetchHandlerType() {}

bool ServiceWorkerGlobalScope::HasHidEventHandlers() {}

bool ServiceWorkerGlobalScope::HasUsbEventHandlers() {}

void ServiceWorkerGlobalScope::GetRemoteAssociatedInterface(
    const String& name,
    mojo::ScopedInterfaceEndpointHandle handle) {}

bool ServiceWorkerGlobalScope::SetAttributeEventListener(
    const AtomicString& event_type,
    EventListener* listener) {}

std::optional<mojo::PendingRemote<network::mojom::blink::URLLoaderFactory>>
ServiceWorkerGlobalScope::FindRaceNetworkRequestURLLoaderFactory(
    const base::UnguessableToken& token) {}

void ServiceWorkerGlobalScope::InsertNewItemToRaceNetworkRequests(
    int fetch_event_id,
    const base::UnguessableToken& token,
    mojo::PendingRemote<network::mojom::blink::URLLoaderFactory>
        url_loader_factory,
    const KURL& request_url) {}

void ServiceWorkerGlobalScope::RemoveItemFromRaceNetworkRequests(
    int fetch_event_id) {}

}  // namespace blink