Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / bindings / templates / interface_base.cpp
blob3f4e4511ea482a2666ffa5ce84cb8c764a8e155b
1 {% include 'copyright_block.txt' %}
2 #include "config.h"
3 {% filter conditional(conditional_string) %}
4 #include "{{v8_class_or_partial}}.h"
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}"
8 {% endfor %}
10 namespace blink {
11 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
12 if is_active_dom_object else '0' %}
13 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
14 if has_visit_dom_wrapper else '0' %}
15 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
16 if parent_interface else '0' %}
17 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
18 'WrapperTypeObjectPrototype' %}
19 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_view else '0' %}
21 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %}
22 {% if not is_partial %}
23 // Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
24 // and does not depend on another global objects.
25 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
26 #pragma clang diagnostic push
27 #pragma clang diagnostic ignored "-Wglobal-constructors"
28 #endif
29 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{v8_class}}::preparePrototypeObject, {{v8_class}}::installConditionallyEnabledProperties, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
30 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
31 #pragma clang diagnostic pop
32 #endif
34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}}.h.
35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
36 // bindings/core/v8/ScriptWrappable.h.
37 {% if not is_typed_array_type %}
38 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperTypeInfo;
39 {% endif %}
41 {% endif %}
42 {% if not is_array_buffer_or_view %}
43 namespace {{cpp_class_or_partial}}V8Internal {
44 {% if has_partial_interface %}
45 {% for method in methods if method.overloads and method.overloads.has_partial_overloads %}
46 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0;
47 {% endfor %}
48 {% endif %}
50 {# Constants #}
51 {% from 'constants.cpp' import constant_getter_callback
52 with context %}
53 {% for constant in special_getter_constants %}
54 {{constant_getter_callback(constant)}}
55 {% endfor %}
56 {# Attributes #}
57 {% block replaceable_attribute_setter_and_callback %}
58 {% if has_replaceable_attributes or has_constructor_attributes %}
59 template<class CallbackInfo>
60 static bool {{cpp_class}}CreateDataProperty(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const CallbackInfo& info)
62 {% if is_check_security %}
63 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
64 v8::String::Utf8Value attributeName(name);
65 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
66 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) {
67 exceptionState.throwIfNeeded();
68 return false;
70 {% endif %}
71 ASSERT(info.This()->IsObject());
72 return v8CallBoolean(v8::Local<v8::Object>::Cast(info.This())->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), name, v8Value));
75 {% if has_constructor_attributes %}
76 static void {{cpp_class}}ConstructorAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
78 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
79 do {
80 v8::Local<v8::Value> data = info.Data();
81 ASSERT(data->IsExternal());
82 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
83 if (!perContextData)
84 break;
85 const WrapperTypeInfo* wrapperTypeInfo = WrapperTypeInfo::unwrap(data);
86 if (!wrapperTypeInfo)
87 break;
88 {{cpp_class}}CreateDataProperty(v8String(info.GetIsolate(), wrapperTypeInfo->interfaceName), v8Value, info);
89 } while (false); // do ... while (false) just for use of break
90 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
93 {% endif %}
94 {% endif %}
95 {% endblock %}
96 {##############################################################################}
97 {% from 'attributes.cpp' import constructor_getter_callback,
98 attribute_getter, attribute_getter_callback,
99 attribute_setter, attribute_setter_callback,
100 attribute_getter_implemented_in_private_script,
101 attribute_setter_implemented_in_private_script
102 with context %}
103 {% for attribute in attributes if attribute.should_be_exposed_to_script %}
104 {% for world_suffix in attribute.world_suffixes %}
105 {% if not attribute.constructor_type %}
106 {% if not attribute.has_custom_getter %}
107 {{attribute_getter(attribute, world_suffix)}}
108 {% endif %}
109 {{attribute_getter_callback(attribute, world_suffix)}}
110 {% endif %}
111 {% if attribute.has_setter %}
112 {% if not attribute.has_custom_setter and
113 (not attribute.constructor_type or attribute.needs_constructor_setter_callback) %}
114 {{attribute_setter(attribute, world_suffix)}}
115 {% endif %}
116 {% if not attribute.constructor_type or attribute.needs_constructor_setter_callback %}
117 {{attribute_setter_callback(attribute, world_suffix)}}
118 {% endif %}
119 {% endif %}
120 {% endfor %}
121 {% endfor %}
122 {##############################################################################}
123 {% for attribute in attributes if attribute.needs_constructor_getter_callback %}
124 {% for world_suffix in attribute.world_suffixes %}
125 {{constructor_getter_callback(attribute, world_suffix)}}
126 {% endfor %}
127 {% endfor %}
128 {##############################################################################}
129 {% block security_check_functions %}
130 {% if has_access_check_callbacks %}
131 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>)
133 {{cpp_class}}* impl = {{v8_class}}::toImpl(host);
134 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
137 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
139 {{cpp_class}}* impl = {{v8_class}}::toImpl(host);
140 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
143 {% endif %}
144 {% endblock %}
145 {##############################################################################}
146 {# Methods #}
147 {% from 'methods.cpp' import generate_method, overload_resolution_method,
148 method_callback, origin_safe_method_getter, generate_constructor,
149 method_implemented_in_private_script, generate_post_message_impl,
150 runtime_determined_length_method, runtime_determined_maxarg_method
151 with context %}
152 {% for method in methods %}
153 {% if method.should_be_exposed_to_script %}
154 {% for world_suffix in method.world_suffixes %}
155 {% if not method.is_custom and not method.is_post_message and method.visible %}
156 {{generate_method(method, world_suffix)}}
157 {% endif %}
158 {% if method.is_post_message %}
159 {{generate_post_message_impl()}}
160 {% endif %}
161 {% if method.overloads and method.overloads.visible %}
162 {% if method.overloads.runtime_determined_lengths %}
163 {{runtime_determined_length_method(method.overloads)}}
164 {% endif %}
165 {% if method.overloads.runtime_determined_maxargs %}
166 {{runtime_determined_maxarg_method(method.overloads)}}
167 {% endif %}
168 {{overload_resolution_method(method.overloads, world_suffix)}}
169 {% endif %}
170 {% if not method.overload_index or method.overloads %}
171 {# Document about the following condition: #}
172 {# https://docs.google.com/document/d/1qBC7Therp437Jbt_QYAtNYMZs6zQ_7_tnMkNUG_ACqs/edit?usp=sharing #}
173 {% if (method.overloads and method.overloads.visible and
174 (not method.overloads.has_partial_overloads or not is_partial)) or
175 (not method.overloads and method.visible) %}
176 {# A single callback is generated for overloaded methods #}
177 {# with considering partial overloads #}
178 {{method_callback(method, world_suffix)}}
179 {% endif %}
180 {% endif %}
181 {% if method.is_do_not_check_security and method.visible %}
182 {{origin_safe_method_getter(method, world_suffix)}}
183 {% endif %}
184 {% endfor %}
185 {% endif %}
186 {% endfor %}
187 {% if iterator_method %}
188 {{generate_method(iterator_method)}}
189 {{method_callback(iterator_method)}}
190 {% endif %}
191 {% block origin_safe_method_setter %}{% endblock %}
192 {# Constructors #}
193 {% for constructor in constructors %}
194 {{generate_constructor(constructor)}}
195 {% endfor %}
196 {% block overloaded_constructor %}{% endblock %}
197 {% block event_constructor %}{% endblock %}
198 {# Special operations (methods) #}
199 {% block indexed_property_getter %}{% endblock %}
200 {% block indexed_property_getter_callback %}{% endblock %}
201 {% block indexed_property_setter %}{% endblock %}
202 {% block indexed_property_setter_callback %}{% endblock %}
203 {% block indexed_property_deleter %}{% endblock %}
204 {% block indexed_property_deleter_callback %}{% endblock %}
205 {% block named_property_getter %}{% endblock %}
206 {% block named_property_getter_callback %}{% endblock %}
207 {% block named_property_setter %}{% endblock %}
208 {% block named_property_setter_callback %}{% endblock %}
209 {% block named_property_query %}{% endblock %}
210 {% block named_property_query_callback %}{% endblock %}
211 {% block named_property_deleter %}{% endblock %}
212 {% block named_property_deleter_callback %}{% endblock %}
213 {% block named_property_enumerator %}{% endblock %}
214 {% block named_property_enumerator_callback %}{% endblock %}
215 } // namespace {{cpp_class_or_partial}}V8Internal
217 {% block visit_dom_wrapper %}{% endblock %}
218 {##############################################################################}
219 {% block install_attributes %}
220 {% from 'attributes.cpp' import attribute_configuration with context %}
221 {% if has_attribute_configuration %}
222 // Suppress warning: global constructors, because AttributeConfiguration is trivial
223 // and does not depend on another global objects.
224 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
225 #pragma clang diagnostic push
226 #pragma clang diagnostic ignored "-Wglobal-constructors"
227 #endif
228 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
229 {% for attribute in attributes
230 if not (attribute.exposed_test or
231 attribute.runtime_enabled_function) and
232 attribute.is_data_type_property and
233 attribute.should_be_exposed_to_script %}
234 {% filter conditional(attribute.conditional_string) %}
235 {{attribute_configuration(attribute)}},
236 {% endfilter %}
237 {% endfor %}
239 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
240 #pragma clang diagnostic pop
241 #endif
243 {% endif %}
244 {% endblock %}
245 {##############################################################################}
246 {% block install_accessors %}
247 {% from 'attributes.cpp' import attribute_configuration with context %}
248 {% if has_accessor_configuration %}
249 const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
250 {% for attribute in attributes
251 if not (attribute.exposed_test or
252 attribute.runtime_enabled_function) and
253 not attribute.is_data_type_property and
254 attribute.should_be_exposed_to_script %}
255 {% filter conditional(attribute.conditional_string) %}
256 {{attribute_configuration(attribute)}},
257 {% endfilter %}
258 {% endfor %}
261 {% endif %}
262 {% endblock %}
263 {##############################################################################}
264 {% block install_methods %}
265 {% from 'methods.cpp' import method_configuration with context %}
266 {% if method_configuration_methods %}
267 const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
268 {% for method in method_configuration_methods %}
269 {% filter conditional(method.conditional_string) %}
270 {{method_configuration(method)}},
271 {% endfilter %}
272 {% endfor %}
275 {% endif %}
276 {% endblock %}
277 {% endif %}{# not is_array_buffer_or_view #}
278 {##############################################################################}
279 {% block named_constructor %}{% endblock %}
280 {% block constructor_callback %}{% endblock %}
281 {##############################################################################}
282 {% block install_dom_template %}
283 {% if not is_array_buffer_or_view %}
284 {% from 'methods.cpp' import install_custom_signature with context %}
285 {% from 'attributes.cpp' import attribute_configuration with context %}
286 {% from 'constants.cpp' import install_constants with context %}
287 {% if has_partial_interface or is_partial %}
288 void {{v8_class_or_partial}}::install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
289 {% else %}
290 static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
291 {% endif %}
293 {% if is_partial %}
294 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate);
295 {% else %}
296 functionTemplate->ReadOnlyPrototype();
297 {% endif %}
299 v8::Local<v8::Signature> defaultSignature;
300 {% set parent_template =
301 'V8%s::domTemplate(isolate)' % parent_interface
302 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %}
303 {% if runtime_enabled_function %}
304 if (!{{runtime_enabled_function}}())
305 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0);
306 else
307 {% endif %}
308 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %}
309 {% filter indent(runtime_enabled_indent, true) %}
310 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount,
311 {# Test needed as size 0 arrays definitions are not allowed per standard
312 (so objects have distinct addresses), which is enforced by MSVC.
313 8.5.1 Aggregates [dcl.init.aggr]
314 An array of unknown size initialized with a brace-enclosed
315 initializer-list containing n initializer-clauses, where n shall be
316 greater than zero, is defined as having n elements (8.3.4). #}
317 {% set attributes_name, attributes_length =
318 ('%sAttributes' % v8_class,
319 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class)
320 if has_attribute_configuration else (0, 0) %}
321 {% set accessors_name, accessors_length =
322 ('%sAccessors' % v8_class,
323 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class)
324 if has_accessor_configuration else (0, 0) %}
325 {% set methods_name, methods_length =
326 ('%sMethods' % v8_class,
327 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class)
328 if method_configuration_methods else (0, 0) %}
329 {{attributes_name}}, {{attributes_length}},
330 {{accessors_name}}, {{accessors_length}},
331 {{methods_name}}, {{methods_length}});
332 {% endfilter %}
334 {% if constructors or has_custom_constructor or has_event_constructor %}
335 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback);
336 functionTemplate->SetLength({{interface_length}});
337 {% endif %}
338 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
339 ALLOW_UNUSED_LOCAL(instanceTemplate);
340 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
341 ALLOW_UNUSED_LOCAL(prototypeTemplate);
342 {% if custom_registration_methods %}
343 ExecutionContext* context = currentExecutionContext(isolate);
344 ALLOW_UNUSED_LOCAL(context);
345 {% endif %}
346 {% if has_access_check_callbacks %}
347 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecurityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
348 {% endif %}
349 {% for attribute in attributes
350 if attribute.runtime_enabled_function and
351 not attribute.exposed_test %}
352 {% filter conditional(attribute.conditional_string) %}
353 if ({{attribute.runtime_enabled_function}}()) {
354 {% if attribute.is_data_type_property %}
355 const V8DOMConfiguration::AttributeConfiguration attributeConfiguration = \
356 {{attribute_configuration(attribute)}};
357 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototypeTemplate, attributeConfiguration);
358 {% else %}
359 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = \
360 {{attribute_configuration(attribute)}};
361 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessorConfiguration);
362 {% endif %}
364 {% endfilter %}
365 {% endfor %}
366 {% if constants %}
367 {{install_constants() | indent}}
368 {% endif %}
369 {# Special operations #}
370 {# V8 has access-check callback API and it\'s used on Window instead of
371 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks.
372 In addition, the getter should be set on the prototype template, to get
373 the implementation straight out of the Window prototype, regardless of
374 what prototype is actually set on the object. #}
375 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window'
376 else 'InstanceTemplate' %}
377 {% if indexed_property_getter %}
378 {# if have indexed properties, MUST have an indexed property getter #}
379 {% set indexed_property_getter_callback =
380 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %}
381 {% set indexed_property_setter_callback =
382 '%sV8Internal::indexedPropertySetterCallback' % cpp_class
383 if indexed_property_setter else '0' %}
384 {% set indexed_property_query_callback = '0' %}{# Unused #}
385 {% set indexed_property_deleter_callback =
386 '%sV8Internal::indexedPropertyDeleterCallback' % cpp_class
387 if indexed_property_deleter else '0' %}
388 {% set indexed_property_enumerator_callback =
389 'indexedPropertyEnumerator<%s>' % cpp_class
390 if indexed_property_getter.is_enumerable else '0' %}
392 v8::IndexedPropertyHandlerConfiguration config({{indexed_property_getter_callback}}, {{indexed_property_setter_callback}}, {{indexed_property_query_callback}}, {{indexed_property_deleter_callback}}, {{indexed_property_enumerator_callback}});
393 {% if indexed_property_getter.do_not_check_security %}
394 config.flags = v8::PropertyHandlerFlags::kAllCanRead;
395 {% endif %}
396 functionTemplate->{{set_on_template}}()->SetHandler(config);
398 {% endif %}
399 {% if named_property_getter %}
400 {# if have named properties, MUST have a named property getter #}
401 {% set named_property_getter_callback =
402 '%sV8Internal::namedPropertyGetterCallback' % cpp_class %}
403 {% set named_property_setter_callback =
404 '%sV8Internal::namedPropertySetterCallback' % cpp_class
405 if named_property_setter else '0' %}
406 {% set named_property_query_callback =
407 '%sV8Internal::namedPropertyQueryCallback' % cpp_class
408 if named_property_getter.is_enumerable else '0' %}
409 {% set named_property_deleter_callback =
410 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class
411 if named_property_deleter else '0' %}
412 {% set named_property_enumerator_callback =
413 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class
414 if named_property_getter.is_enumerable else '0' %}
416 int flags = static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStrings);
417 {% if named_property_getter.do_not_check_security %}
418 flags |= static_cast<int>(v8::PropertyHandlerFlags::kAllCanRead);
419 {% endif %}
420 {% if not is_override_builtins %}
421 flags |= static_cast<int>(v8::PropertyHandlerFlags::kNonMasking);
422 {% endif %}
423 v8::NamedPropertyHandlerConfiguration config({{named_property_getter_callback}}, {{named_property_setter_callback}}, {{named_property_query_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_callback}}, v8::Handle<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(flags));
424 functionTemplate->{{set_on_template}}()->SetHandler(config);
426 {% endif %}
427 {% if iterator_method %}
428 {% filter exposed(iterator_method.exposed_test) %}
429 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %}
430 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
431 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration);
432 {% endfilter %}{# runtime_enabled() #}
433 {% endfilter %}{# exposed() #}
434 {% endif %}
435 {# End special operations #}
436 {% if has_custom_legacy_call_as_function %}
437 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}::legacyCallCustom);
438 {% endif %}
439 {% if interface_name == 'HTMLAllCollection' %}
440 {# Needed for legacy support of document.all #}
441 functionTemplate->InstanceTemplate()->MarkAsUndetectable();
442 {% endif %}
443 {% for method in custom_registration_methods %}
444 {# install_custom_signature #}
445 {% filter conditional(method.conditional_string) %}
446 {% filter exposed(method.overloads.exposed_test_all
447 if method.overloads else
448 method.exposed_test) %}
449 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
450 if method.overloads else
451 method.runtime_enabled_function) %}
452 {% if method.is_do_not_check_security %}
453 {{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prototypeTemplate') | indent}}
454 {% else %}{# is_do_not_check_security #}
455 {% set signature = 'v8::Local<v8::Signature>()' if method.is_do_not_check_signature else 'defaultSignature' %}
456 {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate', 'functionTemplate', signature) | indent}}
457 {% endif %}{# is_do_not_check_security #}
458 {% endfilter %}{# runtime_enabled() #}
459 {% endfilter %}{# exposed() #}
460 {% endfilter %}{# conditional() #}
461 {% endfor %}
462 {# Special interfaces #}
463 {% if not is_partial %}
464 {% if interface_name == 'Window' %}
466 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
467 functionTemplate->SetHiddenPrototype(true);
468 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
469 {% elif interface_name in [
470 'HTMLDocument', 'DedicatedWorkerGlobalScope', 'CompositorWorkerGlobalScope',
471 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %}
472 functionTemplate->SetHiddenPrototype(true);
473 {% endif %}
475 // Custom toString template
476 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
477 {% endif %}
480 {% endif %}{# not is_array_buffer_or_view #}
481 {% endblock %}
482 {##############################################################################}
483 {% block get_dom_template %}{% endblock %}
484 {% block has_instance %}{% endblock %}
485 {% block to_impl %}{% endblock %}
486 {% block to_impl_with_type_check %}{% endblock %}
487 {% block install_conditional_attributes %}{% endblock %}
488 {##############################################################################}
489 {% block prepare_prototype_object %}{% endblock %}
490 {##############################################################################}
491 {% block to_active_dom_object %}{% endblock %}
492 {% block ref_object_and_deref_object %}{% endblock %}
493 {% for method in methods if method.is_implemented_in_private_script and method.visible %}
494 {{method_implemented_in_private_script(method)}}
495 {% endfor %}
496 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
497 {{attribute_getter_implemented_in_private_script(attribute)}}
498 {% if attribute.has_setter %}
499 {{attribute_setter_implemented_in_private_script(attribute)}}
500 {% endif %}
501 {% endfor %}
502 {% block partial_interface %}{% endblock %}
503 } // namespace blink
504 {% endfilter %}