Commit 02df50e5 authored by Yifan Luo's avatar Yifan Luo Committed by Commit Bot

[TrustedTypes] replace union types with WebIDL annotation

This CL add an extended attribute in the WebIDL compiler named
`TrustedType` and change the current ScriptString, ScriptURLString and
HTMLString types in the idl files into DOMString type with a
TrustedType=TrustedScript|TrustedScriptURL|TrustedHTML attribute.

Bug: 1043136
Change-Id: If23c81b59018ede2ef68bc785cde3f70ed9ee981
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2012284Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarDaniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Yifan Luo <lyf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746333}
parent c4a0daca
......@@ -521,6 +521,20 @@ void func([TreatNullAs=Emptytring] DOMString str);
Implementation: Given `[TreatNullAs=EmptyString]`, a JavaScript null is converted to a Blink empty string, for which `String::IsEmpty()` returns true, but `String::IsNull()` return false.
### [StringContext=TrustedHTML|TrustedScript|TrustedScriptURL] _(t)_
Standard: [TrustedType](https://w3c.github.io/webappsec-trusted-types/dist/spec/#!trustedtypes-extended-attribute)
Summary: Indicate that a DOMString for HTMLs and scripts or USVString for script URLs is to be supplemented with additional Trusted Types enforcement logic.
Usage: Must be specified on a DOMString or a USVString type.
```webidl
typedef [StringContext=TrustedHTML] DOMString TrustedString;
attribute TrustedString str;
void func(TrustedString str);
```
### [Unforgeable] _(m,a)_
Standard: [Unforgeable](http://heycam.github.io/webidl/#Unforgeable)
......
......@@ -98,6 +98,7 @@ SaveSameObject
SecureContext=|*
Serializable
SetterCallWith=ExecutionContext|Isolate|ScriptState
StringContext=TrustedHTML|TrustedScript|TrustedScriptURL
Transferable
TreatNonObjectAsNull
TreatNullAs=EmptyString
......
......@@ -7,10 +7,15 @@
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_element.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/range.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/core/html/custom/ce_reactions_scope.h"
#include "third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/core/xml/dom_parser.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_context_data.h"
namespace blink {
......@@ -210,6 +215,29 @@ Document* ToDocumentFromExecutionContext(ExecutionContext* execution_context) {
return execution_context->ExecutingWindow()->document();
}
ExecutionContext* ExecutionContextFromV8Wrappable(
const LocalDOMWindow* window) {
return window->GetExecutionContext();
}
ExecutionContext* ExecutionContextFromV8Wrappable(
const WorkerGlobalScope* scope) {
return scope->GetExecutionContext();
}
ExecutionContext* ExecutionContextFromV8Wrappable(const Node* node) {
return node->GetDocument().ToExecutionContext();
}
ExecutionContext* ExecutionContextFromV8Wrappable(const Range* range) {
return range->startContainer()->GetDocument().ToExecutionContext();
}
ExecutionContext* ExecutionContextFromV8Wrappable(const DOMParser* parser) {
return parser->GetDocument() ? parser->GetDocument()->ToExecutionContext()
: nullptr;
}
} // namespace bindings
} // namespace blink
......@@ -19,9 +19,14 @@
namespace blink {
class Document;
class DOMParser;
class ExecutionContext;
class LocalDOMWindow;
class Node;
class Range;
class QualifiedName;
class ScriptState;
class WorkerGlobalScope;
CORE_EXPORT void V8ConstructorAttributeGetter(
v8::Local<v8::Name> property_name,
......@@ -132,6 +137,20 @@ CORE_EXPORT bool IsEsIterableObject(v8::Isolate* isolate,
CORE_EXPORT Document* ToDocumentFromExecutionContext(
ExecutionContext* execution_context);
CORE_EXPORT ExecutionContext* ExecutionContextFromV8Wrappable(
const LocalDOMWindow* window);
CORE_EXPORT ExecutionContext* ExecutionContextFromV8Wrappable(
const WorkerGlobalScope* scope);
CORE_EXPORT ExecutionContext* ExecutionContextFromV8Wrappable(const Node* node);
CORE_EXPORT ExecutionContext* ExecutionContextFromV8Wrappable(
const Range* range);
CORE_EXPORT ExecutionContext* ExecutionContextFromV8Wrappable(
const DOMParser* parser);
} // namespace bindings
} // namespace blink
......
......@@ -113,6 +113,16 @@ struct IDLStringBase final : public IDLBaseHelper<String> {};
template <V8StringResourceMode Mode>
struct IDLUSVStringBase final : public IDLBaseHelper<String> {};
template <V8StringResourceMode Mode>
struct IDLStringStringContextTrustedHTMLBase final
: public IDLBaseHelper<String> {};
template <V8StringResourceMode Mode>
struct IDLStringStringContextTrustedScriptBase final
: public IDLBaseHelper<String> {};
template <V8StringResourceMode Mode>
struct IDLUSVStringStringContextTrustedScriptURLBase final
: public IDLBaseHelper<String> {};
// Define non-template versions of the above for simplicity.
using IDLByteString = IDLByteStringBase<V8StringResourceMode::kDefaultMode>;
using IDLString = IDLStringBase<V8StringResourceMode::kDefaultMode>;
......@@ -130,6 +140,33 @@ using IDLUSVStringOrNull =
using IDLStringTreatNullAsEmptyString =
IDLStringBase<V8StringResourceMode::kTreatNullAsEmptyString>;
// [StringContext] Strings
using IDLStringStringContextTrustedHTML =
IDLStringStringContextTrustedHTMLBase<V8StringResourceMode::kDefaultMode>;
using IDLStringStringContextTrustedScript =
IDLStringStringContextTrustedScriptBase<V8StringResourceMode::kDefaultMode>;
using IDLUSVStringStringContextTrustedScriptURL =
IDLUSVStringStringContextTrustedScriptURLBase<
V8StringResourceMode::kDefaultMode>;
using IDLStringStringContextTrustedHTMLOrNull =
IDLStringStringContextTrustedHTMLBase<
V8StringResourceMode::kTreatNullAndUndefinedAsNullString>;
using IDLStringStringContextTrustedScriptOrNull =
IDLStringStringContextTrustedScriptBase<
V8StringResourceMode::kTreatNullAndUndefinedAsNullString>;
using IDLUSVStringStringContextTrustedScriptURLOrNull =
IDLUSVStringStringContextTrustedScriptURLBase<
V8StringResourceMode::kTreatNullAndUndefinedAsNullString>;
using IDLStringStringContextTrustedHTMLTreatNullAsEmptyString =
IDLStringStringContextTrustedHTMLBase<
V8StringResourceMode::kTreatNullAsEmptyString>;
using IDLStringStringContextTrustedScriptTreatNullAsEmptyString =
IDLStringStringContextTrustedScriptBase<
V8StringResourceMode::kTreatNullAsEmptyString>;
using IDLUSVStringStringContextTrustedScriptURLTreatNullAsEmptyString =
IDLUSVStringStringContextTrustedScriptURLBase<
V8StringResourceMode::kTreatNullAsEmptyString>;
// Strings for the new bindings generator
namespace bindings {
......
......@@ -11,7 +11,11 @@
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.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/core_export.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_data_view.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
......@@ -193,6 +197,72 @@ struct NativeValueTraits<IDLStringBase<mode>>
}
};
template <V8StringResourceMode mode>
struct NativeValueTraits<IDLStringStringContextTrustedHTMLBase<mode>>
: public NativeValueTraitsBase<
IDLStringStringContextTrustedHTMLBase<mode>> {
static String NativeValue(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state,
ExecutionContext* execution_context) {
if (V8TrustedHTML::HasInstance(value, isolate)) {
TrustedHTML* trusted_value =
V8TrustedHTML::ToImpl(v8::Local<v8::Object>::Cast(value));
return trusted_value->toString();
} else {
V8StringResource<mode> string(value);
if (!string.Prepare(isolate, exception_state))
return String();
return GetStringFromTrustedHTML(string, execution_context,
exception_state);
}
}
};
template <V8StringResourceMode mode>
struct NativeValueTraits<IDLStringStringContextTrustedScriptBase<mode>>
: public NativeValueTraitsBase<
IDLStringStringContextTrustedScriptBase<mode>> {
static String NativeValue(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state,
ExecutionContext* execution_context) {
if (V8TrustedScript::HasInstance(value, isolate)) {
TrustedScript* trusted_value =
V8TrustedScript::ToImpl(v8::Local<v8::Object>::Cast(value));
return trusted_value->toString();
} else {
V8StringResource<mode> string(value);
if (!string.Prepare(isolate, exception_state))
return String();
return GetStringFromTrustedScript(string, execution_context,
exception_state);
}
}
};
template <V8StringResourceMode mode>
struct NativeValueTraits<IDLUSVStringStringContextTrustedScriptURLBase<mode>>
: public NativeValueTraitsBase<
IDLUSVStringStringContextTrustedScriptURLBase<mode>> {
static String NativeValue(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state,
ExecutionContext* execution_context) {
if (V8TrustedScriptURL::HasInstance(value, isolate)) {
TrustedScriptURL* trusted_value =
V8TrustedScriptURL::ToImpl(v8::Local<v8::Object>::Cast(value));
return trusted_value->toString();
} else {
V8StringResource<mode> string(value);
if (!string.Prepare(isolate, exception_state))
return String();
return GetStringFromTrustedScriptURL(string, execution_context,
exception_state);
}
}
};
template <V8StringResourceMode mode>
struct NativeValueTraits<IDLUSVStringBase<mode>>
: public NativeValueTraitsBase<IDLUSVStringBase<mode>> {
......
......@@ -356,6 +356,33 @@ VectorOf<typename NativeValueTraits<IDLType>::ImplType> ToImplArguments(
return result;
}
template <typename IDLType>
VectorOf<typename NativeValueTraits<IDLType>::ImplType> ToImplArguments(
const v8::FunctionCallbackInfo<v8::Value>& info,
int start_index,
ExceptionState& exception_state,
ExecutionContext* execution_context) {
using TraitsType = NativeValueTraits<IDLType>;
using VectorType = VectorOf<typename TraitsType::ImplType>;
int length = info.Length();
VectorType result;
if (start_index < length) {
if (static_cast<size_t>(length - start_index) > VectorType::MaxCapacity()) {
exception_state.ThrowRangeError("Array length exceeds supported limit.");
return VectorType();
}
result.ReserveInitialCapacity(length - start_index);
for (int i = start_index; i < length; ++i) {
result.UncheckedAppend(TraitsType::NativeValue(
info.GetIsolate(), info[i], exception_state, execution_context));
if (exception_state.HadException())
return VectorType();
}
}
return result;
}
// The functions below implement low-level abstract ES operations for dealing
// with iterators. Most code should use ScriptIterator instead.
//
......
......@@ -87,6 +87,7 @@ EXTENDED_ATTRIBUTES_APPLICABLE_TO_TYPES = frozenset([
'AllowShared',
'Clamp',
'EnforceRange',
'StringContext',
'TreatNullAs',
])
......@@ -608,7 +609,8 @@ class IdlNullableType(IdlTypeBase):
class IdlAnnotatedType(IdlTypeBase):
"""IdlAnnoatedType represents an IDL type with extended attributes.
[Clamp], [EnforceRange], and [TreatNullAs] are applicable to types.
[Clamp], [EnforceRange], [StringContext], and [TreatNullAs] are applicable
to types.
https://heycam.github.io/webidl/#idl-annotated-types
"""
......@@ -621,6 +623,9 @@ class IdlAnnotatedType(IdlTypeBase):
for key in extended_attributes):
raise ValueError('Extended attributes not applicable to types: %s' % self)
if 'StringContext' in extended_attributes and inner_type.base_type not in ['DOMString', 'USVString']:
raise ValueError('StringContext is only applicable to string types.')
def __str__(self):
annotation = ', '.join((key + ('' if val is None else '=' + val))
for key, val in self.extended_attributes.iteritems())
......@@ -643,6 +648,10 @@ class IdlAnnotatedType(IdlTypeBase):
def is_annotated_type(self):
return True
@property
def has_string_context(self):
return 'StringContext' in self.extended_attributes
@property
def name(self):
annotation = ''.join((key + ('' if val is None else val))
......
......@@ -124,6 +124,10 @@ def attribute_context(interface, attribute, interfaces, component_info):
'SameObject' in attribute.extended_attributes and
'SaveSameObject' in attribute.extended_attributes)
# [StringContext]
if idl_type.has_string_context:
includes.add('bindings/core/v8/generated_code_helper.h')
# [CachedAccessor]
is_cached_accessor = 'CachedAccessor' in extended_attributes
......
......@@ -297,6 +297,8 @@ def method_context(interface, method, component_info, is_visible=True):
def argument_context(interface, method, argument, index, is_visible=True):
extended_attributes = argument.extended_attributes
idl_type = argument.idl_type
if idl_type.has_string_context:
includes.add('third_party/blink/renderer/bindings/core/v8/generated_code_helper.h')
if is_visible:
idl_type.add_includes_for_type(extended_attributes)
this_cpp_value = cpp_value(interface, method, index)
......@@ -427,9 +429,12 @@ def v8_value_to_local_cpp_variadic_value(argument, index):
assert argument.is_variadic
idl_type = v8_types.native_value_traits_type_name(argument.idl_type,
argument.extended_attributes, True)
execution_context_if_needed = ''
if argument.idl_type.has_string_context:
execution_context_if_needed = ', bindings::ExecutionContextFromV8Wrappable(impl)'
assign_expression = 'ToImplArguments<%s>(info, %s, exception_state%s)' % (idl_type, index, execution_context_if_needed)
return {
'assign_expression': 'ToImplArguments<%s>(info, %s, exception_state)' % (idl_type, index),
'assign_expression': assign_expression,
'check_expression': 'exception_state.HadException()',
'cpp_name': NameStyleConverter(argument.name).to_snake_case(),
'declare_variable': False,
......
......@@ -41,6 +41,7 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
import posixpath
from idl_types import IdlAnnotatedType
from idl_types import IdlArrayOrSequenceType
from idl_types import IdlNullableType
from idl_types import IdlRecordType
......@@ -155,6 +156,7 @@ def string_resource_mode(idl_type):
treat_null_as = idl_type.extended_attributes.get('TreatNullAs')
if treat_null_as == 'EmptyString':
return 'kTreatNullAsEmptyString'
elif treat_null_as:
raise ValueError('Unknown value for [TreatNullAs]: %s' % treat_null_as)
return ''
......@@ -238,6 +240,8 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_
if base_idl_type == 'SerializedScriptValue':
return 'scoped_refptr<%s>' % base_idl_type
if idl_type.is_string_type:
if idl_type.has_string_context:
return 'String'
if not raw_type:
return 'const String&' if used_as_rvalue_type else 'String'
return 'V8StringResource<%s>' % string_resource_mode(idl_type)
......@@ -588,10 +592,12 @@ V8_VALUE_TO_CPP_VALUE = {
def v8_conversion_needs_exception_state(idl_type):
return (idl_type.is_numeric_type or idl_type.is_enum or idl_type.is_dictionary or idl_type.is_array_buffer_view_or_typed_array
or idl_type.has_string_context
or idl_type.name in ('Boolean', 'ByteString', 'Dictionary', 'Object', 'USVString', 'SerializedScriptValue'))
IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_exception_state)
IdlAnnotatedType.v8_conversion_needs_exception_state = property(v8_conversion_needs_exception_state)
IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True
IdlRecordType.v8_conversion_needs_exception_state = True
IdlUnionType.v8_conversion_needs_exception_state = True
......@@ -680,7 +686,10 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name
else:
arguments = v8_value
if base_idl_type in V8_VALUE_TO_CPP_VALUE:
if idl_type.has_string_context:
cpp_expression_format = 'NativeValueTraits<IDL%s>::NativeValue(%s, %s, exception_state, bindings::ExecutionContextFromV8Wrappable(impl))' % (
idl_type.name, isolate, v8_value)
elif base_idl_type in V8_VALUE_TO_CPP_VALUE:
cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type]
elif idl_type.name == 'ArrayBuffer':
cpp_expression_format = (
......@@ -692,7 +701,6 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name
cpp_expression_format = ('ToMaybeShared<%s>({isolate}, {v8_value}, exception_state)' % this_cpp_type)
else:
cpp_expression_format = ('ToNotShared<%s>({isolate}, {v8_value}, exception_state)' % this_cpp_type)
elif idl_type.is_union_type:
nullable = 'UnionTypeConversionMode::kNullable' if idl_type.includes_nullable_type \
else 'UnionTypeConversionMode::kNotNullable'
......
......@@ -31,6 +31,10 @@
// Test for interface extended attributes and special operations.
// Also used as a target by TestObject
typedef [StringContext=TrustedHTML] DOMString TrustedHTMLString;
typedef [StringContext=TrustedScript] DOMString TrustedScriptString;
typedef [StringContext=TrustedScriptURL] USVString TrustedScriptURLString;
[
ActiveScriptWrappable,
Custom=LegacyCallAsFunction,
......@@ -148,6 +152,16 @@
// Arguments that are sequences or records of nullable types.
void methodWithNullableSequences(sequence<double?> numbers, sequence<DOMString?> strings, sequence<Element?> elements, sequence<(double or DOMString)?> unions);
void methodWithNullableRecords(record<DOMString, double?> numbers, record<DOMString, DOMString?> strings, record<DOMString, Element?> elements, record<DOMString, (double or DOMString)?> unions);
// Trusted Types
[RaisesException=Setter] attribute TrustedScriptString scriptString;
[CallWith=ScriptState, RaisesException] long setTimeoutForScript(TrustedScriptString handler);
[RaisesException=Setter] attribute TrustedHTMLString htmlString;
[CallWith=ScriptState, RaisesException] long setTimeoutForHTML(TrustedHTMLString handler);
[RaisesException=Setter] attribute TrustedScriptURLString scriptURLString;
[CallWith=ScriptState, RaisesException] long setTimeoutForScriptURL(TrustedScriptURLString handler);
[RaisesException=Setter] attribute TrustedScriptString? optionalScriptString;
[RaisesException=Setter] attribute [StringContext=TrustedHTML, TreatNullAs=EmptyString] DOMString treatNullAsEmptyStringHTMLString;
};
TestInterface includes TestInterfaceMixin;
......
......@@ -13,6 +13,7 @@
#include <algorithm>
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h"
#include "third_party/blink/renderer/bindings/core/v8/idl_types.h"
#include "third_party/blink/renderer/bindings/core/v8/js_event_handler.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h"
......@@ -921,6 +922,146 @@ static void SecureContextWorkerExposedRuntimeEnabledAttributeAttributeSetter(
impl->setSecureContextWorkerExposedRuntimeEnabledAttribute(cpp_value);
}
static void ScriptStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
V8SetReturnValueString(info, impl->scriptString(), info.GetIsolate());
}
static void ScriptStringAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestInterface", "scriptString");
// Prepare the value to be set.
String cpp_value = NativeValueTraits<IDLStringStringContextTrustedScript>::NativeValue(info.GetIsolate(), v8_value, exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
impl->setScriptString(cpp_value, exception_state);
}
static void HTMLStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
V8SetReturnValueString(info, impl->htmlString(), info.GetIsolate());
}
static void HTMLStringAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestInterface", "htmlString");
// Prepare the value to be set.
String cpp_value = NativeValueTraits<IDLStringStringContextTrustedHTML>::NativeValue(info.GetIsolate(), v8_value, exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
impl->setHTMLString(cpp_value, exception_state);
}
static void ScriptURLStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
V8SetReturnValueString(info, impl->scriptURLString(), info.GetIsolate());
}
static void ScriptURLStringAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestInterface", "scriptURLString");
// Prepare the value to be set.
String cpp_value = NativeValueTraits<IDLUSVStringStringContextTrustedScriptURL>::NativeValue(info.GetIsolate(), v8_value, exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
impl->setScriptURLString(cpp_value, exception_state);
}
static void OptionalScriptStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
V8SetReturnValueStringOrNull(info, impl->optionalScriptString(), info.GetIsolate());
}
static void OptionalScriptStringAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestInterface", "optionalScriptString");
// Prepare the value to be set.
String cpp_value = NativeValueTraits<IDLStringStringContextTrustedScriptOrNull>::NativeValue(info.GetIsolate(), v8_value, exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
impl->setOptionalScriptString(cpp_value, exception_state);
}
static void TreatNullAsEmptyStringHTMLStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
V8SetReturnValueString(info, impl->treatNullAsEmptyStringHTMLString(), info.GetIsolate());
}
static void TreatNullAsEmptyStringHTMLStringAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestInterface", "treatNullAsEmptyStringHTMLString");
// Prepare the value to be set.
String cpp_value = NativeValueTraits<IDLStringStringContextTrustedHTMLTreatNullAsEmptyString>::NativeValue(info.GetIsolate(), v8_value, exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
impl->setTreatNullAsEmptyStringHTMLString(cpp_value, exception_state);
}
static void MixinReadonlyStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
......@@ -2127,6 +2268,78 @@ static void MethodWithNullableRecordsMethod(const v8::FunctionCallbackInfo<v8::V
impl->methodWithNullableRecords(numbers, strings, elements, unions);
}
static void SetTimeoutForScriptMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestInterface", "setTimeoutForScript");
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(info.Holder());
ScriptState* script_state = ScriptState::ForRelevantRealm(info);
if (UNLIKELY(info.Length() < 1)) {
exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length()));
return;
}
String handler;
handler = NativeValueTraits<IDLStringStringContextTrustedScript>::NativeValue(info.GetIsolate(), info[0], exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
int32_t result = impl->setTimeoutForScript(script_state, handler, exception_state);
if (exception_state.HadException()) {
return;
}
V8SetReturnValueInt(info, result);
}
static void SetTimeoutForHTMLMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestInterface", "setTimeoutForHTML");
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(info.Holder());
ScriptState* script_state = ScriptState::ForRelevantRealm(info);
if (UNLIKELY(info.Length() < 1)) {
exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length()));
return;
}
String handler;
handler = NativeValueTraits<IDLStringStringContextTrustedHTML>::NativeValue(info.GetIsolate(), info[0], exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
int32_t result = impl->setTimeoutForHTML(script_state, handler, exception_state);
if (exception_state.HadException()) {
return;
}
V8SetReturnValueInt(info, result);
}
static void SetTimeoutForScriptURLMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestInterface", "setTimeoutForScriptURL");
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(info.Holder());
ScriptState* script_state = ScriptState::ForRelevantRealm(info);
if (UNLIKELY(info.Length() < 1)) {
exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length()));
return;
}
String handler;
handler = NativeValueTraits<IDLUSVStringStringContextTrustedScriptURL>::NativeValue(info.GetIsolate(), info[0], exception_state, bindings::ExecutionContextFromV8Wrappable(impl));
if (exception_state.HadException())
return;
int32_t result = impl->setTimeoutForScriptURL(script_state, handler, exception_state);
if (exception_state.HadException()) {
return;
}
V8SetReturnValueInt(info, result);
}
static void MixinVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestInterfaceImplementation* impl = V8TestInterface::ToImpl(info.Holder());
......@@ -3077,6 +3290,81 @@ void V8TestInterface::SecureContextWorkerExposedRuntimeEnabledAttributeAttribute
test_interface_implementation_v8_internal::SecureContextWorkerExposedRuntimeEnabledAttributeAttributeSetter(v8_value, info);
}
void V8TestInterface::ScriptStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_scriptString_Getter");
test_interface_implementation_v8_internal::ScriptStringAttributeGetter(info);
}
void V8TestInterface::ScriptStringAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_scriptString_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_interface_implementation_v8_internal::ScriptStringAttributeSetter(v8_value, info);
}
void V8TestInterface::HTMLStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_htmlString_Getter");
test_interface_implementation_v8_internal::HTMLStringAttributeGetter(info);
}
void V8TestInterface::HTMLStringAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_htmlString_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_interface_implementation_v8_internal::HTMLStringAttributeSetter(v8_value, info);
}
void V8TestInterface::ScriptURLStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_scriptURLString_Getter");
test_interface_implementation_v8_internal::ScriptURLStringAttributeGetter(info);
}
void V8TestInterface::ScriptURLStringAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_scriptURLString_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_interface_implementation_v8_internal::ScriptURLStringAttributeSetter(v8_value, info);
}
void V8TestInterface::OptionalScriptStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_optionalScriptString_Getter");
test_interface_implementation_v8_internal::OptionalScriptStringAttributeGetter(info);
}
void V8TestInterface::OptionalScriptStringAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_optionalScriptString_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_interface_implementation_v8_internal::OptionalScriptStringAttributeSetter(v8_value, info);
}
void V8TestInterface::TreatNullAsEmptyStringHTMLStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_treatNullAsEmptyStringHTMLString_Getter");
test_interface_implementation_v8_internal::TreatNullAsEmptyStringHTMLStringAttributeGetter(info);
}
void V8TestInterface::TreatNullAsEmptyStringHTMLStringAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_treatNullAsEmptyStringHTMLString_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_interface_implementation_v8_internal::TreatNullAsEmptyStringHTMLStringAttributeSetter(v8_value, info);
}
void V8TestInterface::MixinReadonlyStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_mixinReadonlyStringAttribute_Getter");
......@@ -3652,6 +3940,27 @@ void V8TestInterface::MethodWithNullableRecordsMethodCallback(const v8::Function
test_interface_implementation_v8_internal::MethodWithNullableRecordsMethod(info);
}
void V8TestInterface::SetTimeoutForScriptMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
BLINK_BINDINGS_TRACE_EVENT("TestInterface.setTimeoutForScript");
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_setTimeoutForScript");
test_interface_implementation_v8_internal::SetTimeoutForScriptMethod(info);
}
void V8TestInterface::SetTimeoutForHTMLMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
BLINK_BINDINGS_TRACE_EVENT("TestInterface.setTimeoutForHTML");
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_setTimeoutForHTML");
test_interface_implementation_v8_internal::SetTimeoutForHTMLMethod(info);
}
void V8TestInterface::SetTimeoutForScriptURLMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
BLINK_BINDINGS_TRACE_EVENT("TestInterface.setTimeoutForScriptURL");
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_setTimeoutForScriptURL");
test_interface_implementation_v8_internal::SetTimeoutForScriptURLMethod(info);
}
void V8TestInterface::MixinVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
BLINK_BINDINGS_TRACE_EVENT("TestInterface.mixinVoidMethod");
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestInterfaceImplementation_mixinVoidMethod");
......@@ -3960,6 +4269,9 @@ static constexpr V8DOMConfiguration::MethodConfiguration kV8TestInterfaceMethods
{"sideEffectFreeMethod", V8TestInterface::SideEffectFreeMethodMethodCallback, 0, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasNoSideEffect, V8DOMConfiguration::kAllWorlds},
{"methodWithNullableSequences", V8TestInterface::MethodWithNullableSequencesMethodCallback, 4, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"methodWithNullableRecords", V8TestInterface::MethodWithNullableRecordsMethodCallback, 4, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"setTimeoutForScript", V8TestInterface::SetTimeoutForScriptMethodCallback, 1, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"setTimeoutForHTML", V8TestInterface::SetTimeoutForHTMLMethodCallback, 1, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"setTimeoutForScriptURL", V8TestInterface::SetTimeoutForScriptURLMethodCallback, 1, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"mixinVoidMethod", V8TestInterface::MixinVoidMethodMethodCallback, 0, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"mixinComplexMethod", V8TestInterface::MixinComplexMethodMethodCallback, 2, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
{"mixinCustomVoidMethod", V8TestInterface::MixinCustomVoidMethodMethodCallback, 0, v8::None, V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds},
......@@ -4033,6 +4345,11 @@ void V8TestInterface::InstallV8TestInterfaceTemplate(
{ "alwaysExposedAttribute", V8TestInterface::AlwaysExposedAttributeAttributeGetterCallback, V8TestInterface::AlwaysExposedAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "lenientThisAttribute", V8TestInterface::LenientThisAttributeAttributeGetterCallback, V8TestInterface::LenientThisAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kDoNotCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "attributeWithSideEffectFreeGetter", V8TestInterface::AttributeWithSideEffectFreeGetterAttributeGetterCallback, V8TestInterface::AttributeWithSideEffectFreeGetterAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasNoSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "scriptString", V8TestInterface::ScriptStringAttributeGetterCallback, V8TestInterface::ScriptStringAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "htmlString", V8TestInterface::HTMLStringAttributeGetterCallback, V8TestInterface::HTMLStringAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "scriptURLString", V8TestInterface::ScriptURLStringAttributeGetterCallback, V8TestInterface::ScriptURLStringAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "optionalScriptString", V8TestInterface::OptionalScriptStringAttributeGetterCallback, V8TestInterface::OptionalScriptStringAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "treatNullAsEmptyStringHTMLString", V8TestInterface::TreatNullAsEmptyStringHTMLStringAttributeGetterCallback, V8TestInterface::TreatNullAsEmptyStringHTMLStringAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "mixinReadonlyStringAttribute", V8TestInterface::MixinReadonlyStringAttributeAttributeGetterCallback, nullptr, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "mixinStringAttribute", V8TestInterface::MixinStringAttributeAttributeGetterCallback, V8TestInterface::MixinStringAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
{ "mixinNodeAttribute", V8TestInterface::MixinNodeAttributeAttributeGetterCallback, V8TestInterface::MixinNodeAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
......
......@@ -139,6 +139,16 @@ class V8TestInterface {
CORE_EXPORT static void SecureContextWindowExposedRuntimeEnabledAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void SecureContextWorkerExposedRuntimeEnabledAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void SecureContextWorkerExposedRuntimeEnabledAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void ScriptStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void ScriptStringAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void HTMLStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void HTMLStringAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void ScriptURLStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void ScriptURLStringAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void OptionalScriptStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void OptionalScriptStringAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void TreatNullAsEmptyStringHTMLStringAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void TreatNullAsEmptyStringHTMLStringAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MixinReadonlyStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MixinStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MixinStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
......@@ -219,6 +229,9 @@ class V8TestInterface {
CORE_EXPORT static void SecureContextWorkerExposedRuntimeEnabledMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MethodWithNullableSequencesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MethodWithNullableRecordsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void SetTimeoutForScriptMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void SetTimeoutForHTMLMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void SetTimeoutForScriptURLMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MixinVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MixinComplexMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
CORE_EXPORT static void MixinCustomVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&);
......
......@@ -12,7 +12,6 @@
#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h"
#include "third_party/blink/renderer/core/dom/document.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/trustedtypes/trusted_html.h"
......
......@@ -64,4 +64,8 @@ void DOMParser::Trace(Visitor* visitor) {
ScriptWrappable::Trace(visitor);
}
Document* DOMParser::GetDocument() const {
return context_document_.Get();
}
} // namespace blink
......@@ -47,6 +47,8 @@ class DOMParser final : public ScriptWrappable {
void Trace(Visitor*) override;
Document* GetDocument() const;
private:
Document* parseFromStringInternal(const String&, const String& type);
......
......@@ -62,7 +62,7 @@ ERROR_REMAP = {
}
_EXTENDED_ATTRIBUTES_APPLICABLE_TO_TYPES = [
'Clamp', 'EnforceRange', 'TreatNullAs']
'Clamp', 'EnforceRange', 'StringContext', 'TreatNullAs']
def Boolean(val):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment