#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include <utility>
#include "base/memory/ptr_util.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "third_party/blink/public/common/security_context/insecure_request_policy.h"
#include "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom-blink.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom-blink.h"
#include "third_party/blink/public/mojom/service_worker/navigation_preload_state.mojom-blink.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/modules/v8/v8_navigation_preload_state.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_container.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_error.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h"
namespace blink {
namespace {
void DidUpdate(ScriptPromiseResolver<ServiceWorkerRegistration>* resolver,
ServiceWorkerRegistration* registration,
mojom::ServiceWorkerErrorType error,
const String& error_msg) { … }
void DidUnregister(ScriptPromiseResolver<IDLBoolean>* resolver,
mojom::ServiceWorkerErrorType error,
const String& error_msg) { … }
void DidEnableNavigationPreload(ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::ServiceWorkerErrorType error,
const String& error_msg) { … }
void DidGetNavigationPreloadState(
ScriptPromiseResolver<NavigationPreloadState>* resolver,
mojom::ServiceWorkerErrorType error,
const String& error_msg,
mojom::blink::NavigationPreloadStatePtr state) { … }
void DidSetNavigationPreloadHeader(
ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::ServiceWorkerErrorType error,
const String& error_msg) { … }
}
ServiceWorkerRegistration* ServiceWorkerRegistration::Take(
ScriptPromiseResolverBase* resolver,
WebServiceWorkerRegistrationObjectInfo info) { … }
ServiceWorkerRegistration::ServiceWorkerRegistration(
ExecutionContext* execution_context,
WebServiceWorkerRegistrationObjectInfo info)
: … { … }
ServiceWorkerRegistration::ServiceWorkerRegistration(
ExecutionContext* execution_context,
mojom::blink::ServiceWorkerRegistrationObjectInfoPtr info)
: … { … }
void ServiceWorkerRegistration::Attach(
WebServiceWorkerRegistrationObjectInfo info) { … }
bool ServiceWorkerRegistration::HasPendingActivity() const { … }
const AtomicString& ServiceWorkerRegistration::InterfaceName() const { … }
NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() { … }
String ServiceWorkerRegistration::scope() const { … }
String ServiceWorkerRegistration::updateViaCache() const { … }
void ServiceWorkerRegistration::EnableNavigationPreload(
bool enable,
ScriptPromiseResolver<IDLUndefined>* resolver) { … }
void ServiceWorkerRegistration::GetNavigationPreloadState(
ScriptPromiseResolver<NavigationPreloadState>* resolver) { … }
void ServiceWorkerRegistration::SetNavigationPreloadHeader(
const String& value,
ScriptPromiseResolver<IDLUndefined>* resolver) { … }
ScriptPromise<ServiceWorkerRegistration> ServiceWorkerRegistration::update(
ScriptState* script_state,
ExceptionState& exception_state) { … }
ScriptPromise<IDLBoolean> ServiceWorkerRegistration::unregister(
ScriptState* script_state,
ExceptionState& exception_state) { … }
ServiceWorkerRegistration::~ServiceWorkerRegistration() = default;
void ServiceWorkerRegistration::Dispose() { … }
void ServiceWorkerRegistration::Trace(Visitor* visitor) const { … }
void ServiceWorkerRegistration::ContextDestroyed() { … }
void ServiceWorkerRegistration::SetServiceWorkerObjects(
mojom::blink::ChangedServiceWorkerObjectsMaskPtr changed_mask,
mojom::blink::ServiceWorkerObjectInfoPtr installing,
mojom::blink::ServiceWorkerObjectInfoPtr waiting,
mojom::blink::ServiceWorkerObjectInfoPtr active) { … }
void ServiceWorkerRegistration::SetUpdateViaCache(
mojom::blink::ServiceWorkerUpdateViaCache update_via_cache) { … }
void ServiceWorkerRegistration::UpdateFound() { … }
void ServiceWorkerRegistration::UpdateInternal(
mojom::blink::FetchClientSettingsObjectPtr mojom_settings_object,
ScriptPromiseResolver<ServiceWorkerRegistration>* resolver) { … }
void ServiceWorkerRegistration::UnregisterInternal(
ScriptPromiseResolver<IDLBoolean>* resolver) { … }
}