#include "third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_html.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script_url.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/event_target_names.h"
#include "third_party/blink/renderer/core/events/before_create_policy_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/inspector/exception_metadata.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/trustedtypes/event_handler_names.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_html.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_script.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_type_policy.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
namespace blink {
namespace {
const char* kHtmlNamespace = …;
struct AttributeTypeEntry { … };
AttributeTypeVector;
AttributeTypeVector BuildAttributeVector() { … }
const AttributeTypeVector& GetAttributeTypeVector() { … }
AttributeTypeVector BuildPropertyVector() { … }
const AttributeTypeVector& GetPropertyTypeVector() { … }
SpecificTrustedType FindUnboundAttributeInAttributeTypeVector(
const AttributeTypeVector& attribute_type_vector,
const AtomicString& attribute) { … }
SpecificTrustedType FindEntryInAttributeTypeVector(
const AttributeTypeVector& attribute_type_vector,
const AtomicString& element,
const AtomicString& attribute,
const AtomicString& element_namespace,
const AtomicString& attribute_namespace) { … }
SpecificTrustedType FindEntryInAttributeTypeVector(
const AttributeTypeVector& attribute_type_vector,
const String& element,
const String& attribute,
const String& element_namespace,
const String& attribute_namespace) { … }
}
TrustedTypePolicy* TrustedTypePolicyFactory::createPolicy(
const String& policy_name,
ExceptionState& exception_state) { … }
TrustedTypePolicy* TrustedTypePolicyFactory::createPolicy(
const String& policy_name,
const TrustedTypePolicyOptions* policy_options,
ExceptionState& exception_state) { … }
TrustedTypePolicy* TrustedTypePolicyFactory::defaultPolicy() const { … }
TrustedTypePolicyFactory::TrustedTypePolicyFactory(ExecutionContext* context)
: … { … }
bool TrustedTypePolicyFactory::isHTML(ScriptState* script_state,
const ScriptValue& script_value) { … }
bool TrustedTypePolicyFactory::isScript(ScriptState* script_state,
const ScriptValue& script_value) { … }
bool TrustedTypePolicyFactory::isScriptURL(ScriptState* script_state,
const ScriptValue& script_value) { … }
TrustedHTML* TrustedTypePolicyFactory::emptyHTML() const { … }
TrustedScript* TrustedTypePolicyFactory::emptyScript() const { … }
String getTrustedTypeName(SpecificTrustedType type) { … }
String TrustedTypePolicyFactory::getPropertyType(
const String& tagName,
const String& propertyName,
const String& elementNS) const { … }
String TrustedTypePolicyFactory::getAttributeType(
const String& tagName,
const String& attributeName,
const String& tagNS,
const String& attributeNS) const { … }
ScriptValue TrustedTypePolicyFactory::getTypeMapping(
ScriptState* script_state) const { … }
namespace {
void EnsureAttributeAndPropertiesDict(
ScriptState* script_state,
v8::Local<v8::Object>& top,
const v8::Local<v8::String>& element,
const v8::Local<v8::String>& attributes_or_properties) { … }
void PopulateTypeMapping(
ScriptState* script_state,
v8::Local<v8::Object>& top,
const AttributeTypeVector& attribute_vector,
const v8::Local<v8::String>& attributes_or_properties) { … }
}
ScriptValue TrustedTypePolicyFactory::getTypeMapping(ScriptState* script_state,
const String& ns) const { … }
void TrustedTypePolicyFactory::CountTrustedTypeAssignmentError() { … }
const AtomicString& TrustedTypePolicyFactory::InterfaceName() const { … }
ExecutionContext* TrustedTypePolicyFactory::GetExecutionContext() const { … }
void TrustedTypePolicyFactory::Trace(Visitor* visitor) const { … }
inline bool FindEventHandlerAttributeInTable(
const AtomicString& attributeName) { … }
bool TrustedTypePolicyFactory::IsEventHandlerAttributeName(
const AtomicString& attributeName) { … }
}