#include "third_party/blink/renderer/modules/shared_storage/shared_storage_worklet.h"
#include <optional>
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/common/shared_storage/shared_storage_utils.h"
#include "third_party/blink/public/mojom/origin_trial_feature/origin_trial_feature.mojom-shared.h"
#include "third_party/blink/public/mojom/shared_storage/shared_storage.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_worklet_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_shared_storage_run_operation_method_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_shared_storage_url_with_metadata.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/fetch/request.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/html/fenced_frame/fenced_frame_config.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include "third_party/blink/renderer/modules/shared_storage/shared_storage_window_supplement.h"
#include "third_party/blink/renderer/modules/shared_storage/util.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "url/origin.h"
namespace blink {
namespace {
const char kSharedStorageWorkletExpiredMessage[] = …;
std::optional<BlinkCloneableMessage> Serialize(
const SharedStorageRunOperationMethodOptions* options,
const ExecutionContext& execution_context,
ExceptionState& exception_state) { … }
bool IsValidFencedFrameReportingURL(const KURL& url) { … }
}
SharedStorageWorklet* SharedStorageWorklet::Create(
ScriptState* script_state,
bool cross_origin_script_allowed) { … }
void SharedStorageWorklet::Trace(Visitor* visitor) const { … }
ScriptPromise<IDLUndefined> SharedStorageWorklet::addModule(
ScriptState* script_state,
const String& module_url,
const WorkletOptions* options,
ExceptionState& exception_state) { … }
void SharedStorageWorklet::AddModuleHelper(
ScriptState* script_state,
ScriptPromiseResolverBase* resolver,
const String& module_url,
const WorkletOptions* options,
ExceptionState& exception_state,
bool resolve_to_worklet,
SharedStorageDataOrigin data_origin_type) { … }
ScriptPromise<V8SharedStorageResponse> SharedStorageWorklet::selectURL(
ScriptState* script_state,
const String& name,
HeapVector<Member<SharedStorageUrlWithMetadata>> urls,
ExceptionState& exception_state) { … }
ScriptPromise<V8SharedStorageResponse> SharedStorageWorklet::selectURL(
ScriptState* script_state,
const String& name,
HeapVector<Member<SharedStorageUrlWithMetadata>> urls,
const SharedStorageRunOperationMethodOptions* options,
ExceptionState& exception_state) { … }
ScriptPromise<IDLAny> SharedStorageWorklet::run(
ScriptState* script_state,
const String& name,
ExceptionState& exception_state) { … }
ScriptPromise<IDLAny> SharedStorageWorklet::run(
ScriptState* script_state,
const String& name,
const SharedStorageRunOperationMethodOptions* options,
ExceptionState& exception_state) { … }
SharedStorageWorklet::SharedStorageWorklet(bool cross_origin_script_allowed)
: … { … }
}