#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "base/metrics/histogram_functions.h"
#include "base/tracing/protos/chrome_track_event.pbzero.h"
#include "build/build_config.h"
#include "third_party/blink/public/common/permissions_policy/document_policy_features.h"
#include "third_party/blink/public/mojom/devtools/inspector_issue.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions_policy/policy_disposition.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions_policy/policy_value.mojom-blink.h"
#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/events/event_target.h"
#include "third_party/blink/renderer/core/events/error_event.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_state_observer.h"
#include "third_party/blink/renderer/core/fileapi/public_url_manager.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/csp/execution_context_csp_delegate.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/web_feature.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/loader/document_loader.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/core/workers/worklet_global_scope.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/context_lifecycle_notifier.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/loader/fetch/code_cache_host.h"
#include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h"
#include "third_party/blink/renderer/platform/runtime_feature_state/runtime_feature_state_override_context.h"
#include "third_party/blink/renderer/platform/scheduler/public/event_loop.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/renderer/platform/weborigin/security_policy.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_proto.h"
namespace blink {
ExecutionContext::ExecutionContext(v8::Isolate* isolate,
Agent* agent,
bool is_window)
: … { … }
ExecutionContext::~ExecutionContext() = default;
ExecutionContext* ExecutionContext::From(const ScriptState* script_state) { … }
ExecutionContext* ExecutionContext::From(v8::Local<v8::Context> context) { … }
CodeCacheHost* ExecutionContext::GetCodeCacheHostFromContext(
ExecutionContext* execution_context) { … }
void ExecutionContext::SetIsInBackForwardCache(bool value) { … }
void ExecutionContext::SetLifecycleState(mojom::FrameLifecycleState state) { … }
void ExecutionContext::NotifyContextDestroyed() { … }
void ExecutionContext::CountDeprecation(WebFeature feature) { … }
HeapObserverSet<ContextLifecycleObserver>&
ExecutionContext::ContextLifecycleObserverSet() { … }
unsigned ExecutionContext::ContextLifecycleStateObserverCountForTesting()
const { … }
bool ExecutionContext::SharedArrayBufferTransferAllowed() const { … }
bool ExecutionContext::CheckSharedArrayBufferTransferAllowedAndReport() { … }
void ExecutionContext::FileSharedArrayBufferCreationIssue() { … }
void ExecutionContext::AddConsoleMessageImpl(
mojom::blink::ConsoleMessageSource source,
mojom::blink::ConsoleMessageLevel level,
const String& message,
bool discard_duplicates,
std::optional<mojom::ConsoleMessageCategory> category) { … }
void ExecutionContext::DispatchErrorEvent(
ErrorEvent* error_event,
SanitizeScriptErrors sanitize_script_errors) { … }
bool ExecutionContext::DispatchErrorEventInternal(
ErrorEvent* error_event,
SanitizeScriptErrors sanitize_script_errors) { … }
bool ExecutionContext::IsContextPaused() const { … }
LoaderFreezeMode ExecutionContext::GetLoaderFreezeMode() const { … }
bool ExecutionContext::IsContextFrozenOrPaused() const { … }
int ExecutionContext::CircularSequentialID() { … }
PublicURLManager& ExecutionContext::GetPublicURLManager() { … }
ContentSecurityPolicyDelegate&
ExecutionContext::GetContentSecurityPolicyDelegate() { … }
const DOMWrapperWorld* ExecutionContext::GetCurrentWorld() const { … }
ContentSecurityPolicy*
ExecutionContext::GetContentSecurityPolicyForCurrentWorld() { … }
ContentSecurityPolicy* ExecutionContext::GetContentSecurityPolicyForWorld(
const DOMWrapperWorld* world) { … }
const SecurityOrigin* ExecutionContext::GetSecurityOrigin() const { … }
SecurityOrigin* ExecutionContext::GetMutableSecurityOrigin() { … }
ContentSecurityPolicy* ExecutionContext::GetContentSecurityPolicy() const { … }
void ExecutionContext::SetContentSecurityPolicy(
ContentSecurityPolicy* content_security_policy) { … }
void ExecutionContext::SetRequireTrustedTypes() { … }
void ExecutionContext::SetRequireTrustedTypesForTesting() { … }
network::mojom::blink::WebSandboxFlags ExecutionContext::GetSandboxFlags()
const { … }
bool ExecutionContext::IsSandboxed(
network::mojom::blink::WebSandboxFlags mask) const { … }
const base::UnguessableToken& ExecutionContext::GetAgentClusterID() const { … }
void ExecutionContext::AllowWindowInteraction() { … }
void ExecutionContext::ConsumeWindowInteraction() { … }
bool ExecutionContext::IsWindowInteractionAllowed() const { … }
bool ExecutionContext::IsSecureContext(String& error_message) const { … }
String ExecutionContext::OutgoingReferrer() const { … }
void ExecutionContext::ParseAndSetReferrerPolicy(
const String& policy,
const ReferrerPolicySource source) { … }
network::mojom::ReferrerPolicy ExecutionContext::GetReferrerPolicy() const { … }
void ExecutionContext::SetReferrerPolicy(
network::mojom::ReferrerPolicy referrer_policy) { … }
void ExecutionContext::SetPolicyContainer(
std::unique_ptr<PolicyContainer> container) { … }
std::unique_ptr<PolicyContainer> ExecutionContext::TakePolicyContainer() { … }
void ExecutionContext::RemoveURLFromMemoryCache(const KURL& url) { … }
void ExecutionContext::Trace(Visitor* visitor) const { … }
bool ExecutionContext::IsSameAgentCluster(
const base::UnguessableToken& other_id) const { … }
mojom::blink::V8CacheOptions ExecutionContext::GetV8CacheOptions() const { … }
v8::MicrotaskQueue* ExecutionContext::GetMicrotaskQueue() const { … }
bool ExecutionContext::FeatureEnabled(
mojom::blink::OriginTrialFeature feature) const { … }
bool ExecutionContext::IsFeatureEnabled(
mojom::blink::PermissionsPolicyFeature feature,
ReportOptions report_option,
const String& message) { … }
bool ExecutionContext::IsFeatureEnabled(
mojom::blink::PermissionsPolicyFeature feature) const { … }
bool ExecutionContext::IsFeatureEnabled(
mojom::blink::DocumentPolicyFeature feature) const { … }
bool ExecutionContext::IsFeatureEnabled(
mojom::blink::DocumentPolicyFeature feature,
PolicyValue threshold_value) const { … }
bool ExecutionContext::IsFeatureEnabled(
mojom::blink::DocumentPolicyFeature feature,
ReportOptions report_option,
const String& message,
const String& source_file) { … }
bool ExecutionContext::IsFeatureEnabled(
mojom::blink::DocumentPolicyFeature feature,
PolicyValue threshold_value,
ReportOptions report_option,
const String& message,
const String& source_file) { … }
bool ExecutionContext::RequireTrustedTypes() const { … }
namespace {
ContextType;
ContextType GetContextType(const ExecutionContext& execution_context) { … }
WorldType;
WorldType GetWorldType(const ExecutionContext& execution_context) { … }
}
void ExecutionContext::WriteIntoTrace(
perfetto::TracedProto<ExecutionContext::Proto> proto) const { … }
bool ExecutionContext::CrossOriginIsolatedCapabilityOrDisabledWebSecurity()
const { … }
bool ExecutionContext::IsInjectionMitigatedContext() const { … }
}