v8 14.1.146 (node 25.0.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-template.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_TEMPLATE_H_
6#define INCLUDE_V8_TEMPLATE_H_
7
8#include <cstddef>
9#include <string_view>
10
11#include "v8-data.h" // NOLINT(build/include_directory)
12#include "v8-exception.h" // NOLINT(build/include_directory)
13#include "v8-function-callback.h" // NOLINT(build/include_directory)
14#include "v8-local-handle.h" // NOLINT(build/include_directory)
15#include "v8-memory-span.h" // NOLINT(build/include_directory)
16#include "v8-object.h" // NOLINT(build/include_directory)
17#include "v8config.h" // NOLINT(build/include_directory)
18
19namespace v8 {
20
21class CFunction;
23class ObjectTemplate;
24class Signature;
25
26// --- Templates ---
27
28#define V8_INTRINSICS_LIST(F)
29 F(ArrayProto_entries, array_entries_iterator)
30 F(ArrayProto_forEach, array_for_each_iterator)
31 F(ArrayProto_keys, array_keys_iterator)
32 F(ArrayProto_values, array_values_iterator)
33 F(ArrayPrototype, initial_array_prototype)
34 F(AsyncIteratorPrototype, initial_async_iterator_prototype)
35 F(ErrorPrototype, initial_error_prototype)
36 F(IteratorPrototype, initial_iterator_prototype)
37 F(MapIteratorPrototype, initial_map_iterator_prototype)
38 F(ObjProto_valueOf, object_value_of_function)
39 F(SetIteratorPrototype, initial_set_iterator_prototype)
40
42#define V8_DECL_INTRINSIC(name, iname) k##name,
44#undef V8_DECL_INTRINSIC
45};
46
47/**
48 * The superclass of object and function templates.
49 */
50class V8_EXPORT Template : public Data {
51 public:
52 /**
53 * Adds a property to each instance created by this template.
54 *
55 * The property must be defined either as a primitive value, or a template.
56 */
57 void Set(Local<Name> name, Local<Data> value,
58 PropertyAttribute attributes = None);
59 void SetPrivate(Local<Private> name, Local<Data> value,
60 PropertyAttribute attributes = None);
61 V8_INLINE void Set(Isolate* isolate, const char* name, Local<Data> value,
62 PropertyAttribute attributes = None);
63
64 /**
65 * Sets an "accessor property" on the object template, see
66 * https://tc39.es/ecma262/#sec-object-type.
67 *
68 * Whenever the property with the given name is accessed on objects
69 * created from this ObjectTemplate the getter and setter functions
70 * are called.
71 *
72 * \param name The name of the property for which an accessor is added.
73 * \param getter The callback to invoke when getting the property.
74 * \param setter The callback to invoke when setting the property.
75 * \param attribute The attributes of the property for which an accessor
76 * is added.
77 */
79 Local<Name> name,
80 Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
81 Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
82 PropertyAttribute attribute = None);
83
84 /**
85 * Sets a "data property" on the object template, see
86 * https://tc39.es/ecma262/#sec-object-type.
87 *
88 * Whenever the property with the given name is accessed on objects
89 * created from this Template the getter and setter callbacks
90 * are called instead of getting and setting the property directly
91 * on the JavaScript object.
92 * Note that in case a property is written via a "child" object, the setter
93 * will not be called according to the JavaScript specification. See
94 * https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver.
95 *
96 * \param name The name of the data property for which an accessor is added.
97 * \param getter The callback to invoke when getting the property.
98 * \param setter The callback to invoke when setting the property.
99 * \param data A piece of data that will be passed to the getter and setter
100 * callbacks whenever they are invoked.
101 * \param attribute The attributes of the property for which an accessor
102 * is added.
103 */
105 Local<Name> name, AccessorNameGetterCallback getter,
106 AccessorNameSetterCallback setter = nullptr,
107 Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
108 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
109 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
110
111 /**
112 * Like SetNativeDataProperty, but V8 will replace the native data property
113 * with a real data property on first access.
114 */
116 Local<Name> name, AccessorNameGetterCallback getter,
117 Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
118 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
119 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
120
121 /**
122 * During template instantiation, sets the value with the intrinsic property
123 * from the correct context.
124 */
126 PropertyAttribute attribute = None);
127
128 private:
129 Template();
130
131 friend class ObjectTemplate;
132 friend class FunctionTemplate;
133};
134
135/**
136 * Interceptor callbacks use this value to indicate whether the request was
137 * intercepted or not.
138 */
139enum class Intercepted : uint8_t { kNo = 0, kYes = 1 };
140
141/**
142 * Interceptor for get requests on an object.
143 *
144 * If the interceptor handles the request (i.e. the property should not be
145 * looked up beyond the interceptor or in case an exception was thrown) it
146 * should
147 * - (optionally) use info.GetReturnValue().Set()` to set the return value
148 * (by default the result is set to v8::Undefined),
149 * - return `Intercepted::kYes`.
150 * If the interceptor does not handle the request it must return
151 * `Intercepted::kNo` and it must not produce side effects.
152 *
153 * \param property The name of the property for which the request was
154 * intercepted.
155 * \param info Information about the intercepted request, such as
156 * isolate, receiver, return value, or whether running in `'use strict'` mode.
157 * See `PropertyCallbackInfo`.
158 *
159 * \code
160 * Intercepted GetterCallback(
161 * Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
162 * if (!IsKnownProperty(info.GetIsolate(), name)) return Intercepted::kNo;
163 * info.GetReturnValue().Set(v8_num(42));
164 * return Intercepted::kYes;
165 * }
166 *
167 * v8::Local<v8::FunctionTemplate> templ =
168 * v8::FunctionTemplate::New(isolate);
169 * templ->InstanceTemplate()->SetHandler(
170 * v8::NamedPropertyHandlerConfiguration(GetterCallback));
171 * LocalContext env;
172 * env->Global()
173 * ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
174 * .ToLocalChecked()
175 * ->NewInstance(env.local())
176 * .ToLocalChecked())
177 * .FromJust();
178 * v8::Local<v8::Value> result = CompileRun("obj.a = 17; obj.a");
179 * CHECK(v8_num(42)->Equals(env.local(), result).FromJust());
180 * \endcode
181 *
182 * See also `ObjectTemplate::SetHandler`.
183 */
184using NamedPropertyGetterCallback = Intercepted (*)(
185 Local<Name> property, const PropertyCallbackInfo<Value>& info);
186// This variant will be deprecated soon.
187//
188// Use `info.GetReturnValue().Set()` to set the return value of the
189// intercepted get request. If the property does not exist the callback should
190// not set the result and must not produce side effects.
191using GenericNamedPropertyGetterCallback V8_DEPRECATE_SOON(
192 "Use NamedPropertyGetterCallback instead") =
193 void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
194
195/**
196 * Interceptor for set requests on an object.
197 *
198 * If the interceptor handles the request (i.e. the property should not be
199 * looked up beyond the interceptor or in case an exception was thrown) it
200 * should return `Intercepted::kYes`.
201 * If the interceptor does not handle the request it must return
202 * `Intercepted::kNo` and it must not produce side effects.
203 *
204 * \param property The name of the property for which the request was
205 * intercepted.
206 * \param value The value which the property will have if the request
207 * is not intercepted.
208 * \param info Information about the intercepted request, such as
209 * isolate, receiver, return value, or whether running in `'use strict'` mode.
210 * See `PropertyCallbackInfo`.
211 *
212 * See also `ObjectTemplate::SetHandler.`
213 */
214using NamedPropertySetterCallback =
215 Intercepted (*)(Local<Name> property, Local<Value> value,
216 const PropertyCallbackInfo<void>& info);
217// This variant will be deprecated soon.
218//
219// Use `info.GetReturnValue()` to indicate whether the request was intercepted
220// or not. If the setter successfully intercepts the request, i.e., if the
221// request should not be further executed, call
222// `info.GetReturnValue().Set(value)`. If the setter did not intercept the
223// request, i.e., if the request should be handled as if no interceptor is
224// present, do not not call `Set()` and do not produce side effects.
225using GenericNamedPropertySetterCallback V8_DEPRECATE_SOON(
226 "Use NamedPropertySetterCallback instead") =
227 void (*)(Local<Name> property, Local<Value> value,
228 const PropertyCallbackInfo<Value>& info);
229
230/**
231 * Intercepts all requests that query the attributes of the
232 * property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and
233 * defineProperty().
234 *
235 * If the interceptor handles the request (i.e. the property should not be
236 * looked up beyond the interceptor or in case an exception was thrown) it
237 * should
238 * - (optionally) use `info.GetReturnValue().Set()` to set to an Integer
239 * value encoding a `v8::PropertyAttribute` bits,
240 * - return `Intercepted::kYes`.
241 * If the interceptor does not handle the request it must return
242 * `Intercepted::kNo` and it must not produce side effects.
243 *
244 * \param property The name of the property for which the request was
245 * intercepted.
246 * \param info Information about the intercepted request, such as
247 * isolate, receiver, return value, or whether running in `'use strict'` mode.
248 * See `PropertyCallbackInfo`.
249 *
250 * \note Some functions query the property attributes internally, even though
251 * they do not return the attributes. For example, `hasOwnProperty()` can
252 * trigger this interceptor depending on the state of the object.
253 *
254 * See also `ObjectTemplate::SetHandler.`
255 */
256using NamedPropertyQueryCallback = Intercepted (*)(
257 Local<Name> property, const PropertyCallbackInfo<Integer>& info);
258// This variant will be deprecated soon.
259//
260// Use `info.GetReturnValue().Set(value)` to set the property attributes. The
261// value is an integer encoding a `v8::PropertyAttribute`. If the property does
262// not exist the callback should not set the result and must not produce side
263// effects.
264using GenericNamedPropertyQueryCallback V8_DEPRECATE_SOON(
265 "Use NamedPropertyQueryCallback instead") =
266 void (*)(Local<Name> property, const PropertyCallbackInfo<Integer>& info);
267
268/**
269 * Interceptor for delete requests on an object.
270 *
271 * If the interceptor handles the request (i.e. the property should not be
272 * looked up beyond the interceptor or in case an exception was thrown) it
273 * should
274 * - (optionally) use `info.GetReturnValue().Set()` to set to a Boolean value
275 * indicating whether the property deletion was successful or not,
276 * - return `Intercepted::kYes`.
277 * If the interceptor does not handle the request it must return
278 * `Intercepted::kNo` and it must not produce side effects.
279 *
280 * \param property The name of the property for which the request was
281 * intercepted.
282 * \param info Information about the intercepted request, such as
283 * isolate, receiver, return value, or whether running in `'use strict'` mode.
284 * See `PropertyCallbackInfo`.
285 *
286 * \note If you need to mimic the behavior of `delete`, i.e., throw in strict
287 * mode instead of returning false, use `info.ShouldThrowOnError()` to determine
288 * if you are in strict mode.
289 *
290 * See also `ObjectTemplate::SetHandler.`
291 */
292using NamedPropertyDeleterCallback = Intercepted (*)(
293 Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
294// This variant will be deprecated soon.
295//
296// Use `info.GetReturnValue()` to indicate whether the request was intercepted
297// or not. If the deleter successfully intercepts the request, i.e., if the
298// request should not be further executed, call
299// `info.GetReturnValue().Set(value)` with a boolean `value`. The `value` is
300// used as the return value of `delete`. If the deleter does not intercept the
301// request then it should not set the result and must not produce side effects.
302using GenericNamedPropertyDeleterCallback V8_DEPRECATE_SOON(
303 "Use NamedPropertyDeleterCallback instead") =
304 void (*)(Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
305
306/**
307 * Returns an array containing the names of the properties the named
308 * property getter intercepts.
309 *
310 * Note: The values in the array must be of type v8::Name.
311 */
312using NamedPropertyEnumeratorCallback =
313 void (*)(const PropertyCallbackInfo<Array>& info);
314// This variant will be deprecated soon.
315// This is just a renaming of the typedef.
316using GenericNamedPropertyEnumeratorCallback V8_DEPRECATE_SOON(
317 "Use NamedPropertyEnumeratorCallback instead") =
318 NamedPropertyEnumeratorCallback;
319
320/**
321 * Interceptor for defineProperty requests on an object.
322 *
323 * If the interceptor handles the request (i.e. the property should not be
324 * looked up beyond the interceptor or in case an exception was thrown) it
325 * should return `Intercepted::kYes`.
326 * If the interceptor does not handle the request it must return
327 * `Intercepted::kNo` and it must not produce side effects.
328 *
329 * \param property The name of the property for which the request was
330 * intercepted.
331 * \param desc The property descriptor which is used to define the
332 * property if the request is not intercepted.
333 * \param info Information about the intercepted request, such as
334 * isolate, receiver, return value, or whether running in `'use strict'` mode.
335 * See `PropertyCallbackInfo`.
336 *
337 * See also `ObjectTemplate::SetHandler`.
338 */
339using NamedPropertyDefinerCallback =
340 Intercepted (*)(Local<Name> property, const PropertyDescriptor& desc,
341 const PropertyCallbackInfo<void>& info);
342// This variant will be deprecated soon.
343//
344// Use `info.GetReturnValue()` to indicate whether the request was intercepted
345// or not. If the definer successfully intercepts the request, i.e., if the
346// request should not be further executed, call
347// `info.GetReturnValue().Set(value)`. If the definer did not intercept the
348// request, i.e., if the request should be handled as if no interceptor is
349// present, do not not call `Set()` and do not produce side effects.
350using GenericNamedPropertyDefinerCallback V8_DEPRECATE_SOON(
351 "Use NamedPropertyDefinerCallback instead") =
352 void (*)(Local<Name> property, const PropertyDescriptor& desc,
353 const PropertyCallbackInfo<Value>& info);
354
355/**
356 * Interceptor for getOwnPropertyDescriptor requests on an object.
357 *
358 * If the interceptor handles the request (i.e. the property should not be
359 * looked up beyond the interceptor or in case an exception was thrown) it
360 * should
361 * - (optionally) use `info.GetReturnValue().Set()` to set the return value
362 * which must be object that can be converted to a PropertyDescriptor (for
363 * example, a value returned by `v8::Object::getOwnPropertyDescriptor`),
364 * - return `Intercepted::kYes`.
365 * If the interceptor does not handle the request it must return
366 * `Intercepted::kNo` and it must not produce side effects.
367 *
368 * \param property The name of the property for which the request was
369 * intercepted.
370 * \info Information about the intercepted request, such as
371 * isolate, receiver, return value, or whether running in `'use strict'` mode.
372 * See `PropertyCallbackInfo`.
373 *
374 * \note If GetOwnPropertyDescriptor is intercepted, it will
375 * always return true, i.e., indicate that the property was found.
376 *
377 * See also `ObjectTemplate::SetHandler`.
378 */
379using NamedPropertyDescriptorCallback = Intercepted (*)(
380 Local<Name> property, const PropertyCallbackInfo<Value>& info);
381// This variant will be deprecated soon.
382//
383// Use `info.GetReturnValue().Set()` to set the return value of the
384// intercepted request. The return value must be an object that
385// can be converted to a PropertyDescriptor, e.g., a `v8::Value` returned from
386// `v8::Object::getOwnPropertyDescriptor`.
387using GenericNamedPropertyDescriptorCallback V8_DEPRECATE_SOON(
388 "Use NamedPropertyDescriptorCallback instead") =
389 void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
390
391// TODO(ishell): Rename IndexedPropertyXxxCallbackV2 back to
392// IndexedPropertyXxxCallback once the old IndexedPropertyXxxCallback is
393// removed.
394
395/**
396 * See `v8::NamedPropertyGetterCallback`.
397 */
398using IndexedPropertyGetterCallbackV2 =
399 Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
400// This variant will be deprecated soon.
401using IndexedPropertyGetterCallback V8_DEPRECATE_SOON(
402 "Use IndexedPropertyGetterCallbackV2 instead") =
403 void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
404
405/**
406 * See `v8::NamedPropertySetterCallback`.
407 */
408using IndexedPropertySetterCallbackV2 = Intercepted (*)(
409 uint32_t index, Local<Value> value, const PropertyCallbackInfo<void>& info);
410// This variant will be deprecated soon.
411using IndexedPropertySetterCallback V8_DEPRECATE_SOON(
412 "Use IndexedPropertySetterCallbackV2 instead") =
413 void (*)(uint32_t index, Local<Value> value,
414 const PropertyCallbackInfo<Value>& info);
415
416/**
417 * See `v8::NamedPropertyQueryCallback`.
418 */
419using IndexedPropertyQueryCallbackV2 =
420 Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
421// This variant will be deprecated soon.
422using IndexedPropertyQueryCallback V8_DEPRECATE_SOON(
423 "Use IndexedPropertyQueryCallbackV2 instead") =
424 void (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
425
426/**
427 * See `v8::NamedPropertyDeleterCallback`.
428 */
429using IndexedPropertyDeleterCallbackV2 =
430 Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
431// This variant will be deprecated soon.
432using IndexedPropertyDeleterCallback V8_DEPRECATE_SOON(
433 "Use IndexedPropertyDeleterCallbackV2 instead") =
434 void (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
435
436/**
437 * Returns an array containing the indices of the properties the indexed
438 * property getter intercepts.
439 *
440 * Note: The values in the array must be uint32_t.
441 */
442using IndexedPropertyEnumeratorCallback =
443 void (*)(const PropertyCallbackInfo<Array>& info);
444
445/**
446 * See `v8::NamedPropertyDefinerCallback`.
447 */
448using IndexedPropertyDefinerCallbackV2 =
449 Intercepted (*)(uint32_t index, const PropertyDescriptor& desc,
450 const PropertyCallbackInfo<void>& info);
451// This variant will be deprecated soon.
452using IndexedPropertyDefinerCallback V8_DEPRECATE_SOON(
453 "Use IndexedPropertyDefinerCallbackV2 instead") =
454 void (*)(uint32_t index, const PropertyDescriptor& desc,
455 const PropertyCallbackInfo<Value>& info);
456
457/**
458 * See `v8::NamedPropertyDescriptorCallback`.
459 */
460using IndexedPropertyDescriptorCallbackV2 =
461 Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
462// This variant will be deprecated soon.
463using IndexedPropertyDescriptorCallback V8_DEPRECATE_SOON(
464 "Use IndexedPropertyDescriptorCallbackV2 instead") =
465 void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
466
467/**
468 * Returns true if the given context should be allowed to access the given
469 * object.
470 */
471using AccessCheckCallback = bool (*)(Local<Context> accessing_context,
472 Local<Object> accessed_object,
473 Local<Value> data);
474
476
477/**
478 * A FunctionTemplate is used to create functions at runtime. There
479 * can only be one function created from a FunctionTemplate in a
480 * context. The lifetime of the created function is equal to the
481 * lifetime of the context. So in case the embedder needs to create
482 * temporary functions that can be collected using Scripts is
483 * preferred.
484 *
485 * Any modification of a FunctionTemplate after first instantiation will trigger
486 * a crash.
487 *
488 * A FunctionTemplate can have properties, these properties are added to the
489 * function object when it is created.
490 *
491 * A FunctionTemplate has a corresponding instance template which is
492 * used to create object instances when the function is used as a
493 * constructor. Properties added to the instance template are added to
494 * each object instance.
495 *
496 * A FunctionTemplate can have a prototype template. The prototype template
497 * is used to create the prototype object of the function.
498 *
499 * The following example shows how to use a FunctionTemplate:
500 *
501 * \code
502 * v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
503 * t->Set(isolate, "func_property", v8::Number::New(isolate, 1));
504 *
505 * v8::Local<v8::Template> proto_t = t->PrototypeTemplate();
506 * proto_t->Set(isolate,
507 * "proto_method",
508 * v8::FunctionTemplate::New(isolate, InvokeCallback));
509 * proto_t->Set(isolate, "proto_const", v8::Number::New(isolate, 2));
510 *
511 * v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate();
512 * instance_t->SetNativeDataProperty(
513 * String::NewFromUtf8Literal(isolate, "instance_accessor"),
514 * InstanceAccessorCallback);
515 * instance_t->SetHandler(
516 * NamedPropertyHandlerConfiguration(PropertyHandlerCallback));
517 * instance_t->Set(String::NewFromUtf8Literal(isolate, "instance_property"),
518 * Number::New(isolate, 3));
519 *
520 * v8::Local<v8::Function> function = t->GetFunction();
521 * v8::Local<v8::Object> instance = function->NewInstance();
522 * \endcode
523 *
524 * Let's use "function" as the JS variable name of the function object
525 * and "instance" for the instance object created above. The function
526 * and the instance will have the following properties:
527 *
528 * \code
529 * func_property in function == true;
530 * function.func_property == 1;
531 *
532 * function.prototype.proto_method() invokes 'InvokeCallback'
533 * function.prototype.proto_const == 2;
534 *
535 * instance instanceof function == true;
536 * instance.instance_accessor calls 'InstanceAccessorCallback'
537 * instance.instance_property == 3;
538 * \endcode
539 *
540 * A FunctionTemplate can inherit from another one by calling the
541 * FunctionTemplate::Inherit method. The following graph illustrates
542 * the semantics of inheritance:
543 *
544 * \code
545 * FunctionTemplate Parent -> Parent() . prototype -> { }
546 * ^ ^
547 * | Inherit(Parent) | .__proto__
548 * | |
549 * FunctionTemplate Child -> Child() . prototype -> { }
550 * \endcode
551 *
552 * A FunctionTemplate 'Child' inherits from 'Parent', the prototype
553 * object of the Child() function has __proto__ pointing to the
554 * Parent() function's prototype object. An instance of the Child
555 * function has all properties on Parent's instance templates.
556 *
557 * Let Parent be the FunctionTemplate initialized in the previous
558 * section and create a Child FunctionTemplate by:
559 *
560 * \code
561 * Local<FunctionTemplate> parent = t;
562 * Local<FunctionTemplate> child = FunctionTemplate::New();
563 * child->Inherit(parent);
564 *
565 * Local<Function> child_function = child->GetFunction();
566 * Local<Object> child_instance = child_function->NewInstance();
567 * \endcode
568 *
569 * The Child function and Child instance will have the following
570 * properties:
571 *
572 * \code
573 * child_func.prototype.__proto__ == function.prototype;
574 * child_instance.instance_accessor calls 'InstanceAccessorCallback'
575 * child_instance.instance_property == 3;
576 * \endcode
577 *
578 * The additional 'c_function' parameter refers to a fast API call, which
579 * must not trigger GC or JavaScript execution, or call into V8 in other
580 * ways. For more information how to define them, see
581 * include/v8-fast-api-calls.h. Please note that this feature is still
582 * experimental.
583 */
585 public:
586 /** Creates a function template.*/
588 Isolate* isolate, FunctionCallback callback = nullptr,
589 Local<Value> data = Local<Value>(),
590 Local<Signature> signature = Local<Signature>(), int length = 0,
593 const CFunction* c_function = nullptr, uint16_t instance_type = 0,
594 uint16_t allowed_receiver_instance_type_range_start = 0,
595 uint16_t allowed_receiver_instance_type_range_end = 0);
596
597 /** Creates a function template for multiple overloaded fast API calls.*/
599 Isolate* isolate, FunctionCallback callback = nullptr,
600 Local<Value> data = Local<Value>(),
601 Local<Signature> signature = Local<Signature>(), int length = 0,
604 const MemorySpan<const CFunction>& c_function_overloads = {});
605
606 /**
607 * Creates a function template backed/cached by a private property.
608 */
610 Isolate* isolate, FunctionCallback callback,
611 Local<Private> cache_property, Local<Value> data = Local<Value>(),
612 Local<Signature> signature = Local<Signature>(), int length = 0,
614
615 /** Returns the unique function instance in the current execution context.*/
617 Local<Context> context);
618
619 /**
620 * Similar to Context::NewRemoteContext, this creates an instance that
621 * isn't backed by an actual object.
622 *
623 * The InstanceTemplate of this FunctionTemplate must have access checks with
624 * handlers installed.
625 */
627
628 /**
629 * Set the call-handler callback for a FunctionTemplate. This
630 * callback is called whenever the function created from this
631 * FunctionTemplate is called. The 'c_function' represents a fast
632 * API call, see the comment above the class declaration.
633 */
635 FunctionCallback callback, Local<Value> data = Local<Value>(),
637 const MemorySpan<const CFunction>& c_function_overloads = {});
638
639 /** Set the predefined length property for the FunctionTemplate. */
640 void SetLength(int length);
641
642 /** Get the InstanceTemplate. */
644
645 /**
646 * Causes the function template to inherit from a parent function template.
647 * This means the function's prototype.__proto__ is set to the parent
648 * function's prototype.
649 **/
651
652 /**
653 * A PrototypeTemplate is the template used to create the prototype object
654 * of the function created by this template.
655 */
657
658 /**
659 * A PrototypeProviderTemplate is another function template whose prototype
660 * property is used for this template. This is mutually exclusive with setting
661 * a prototype template indirectly by calling PrototypeTemplate() or using
662 * Inherit().
663 **/
665
666 /**
667 * Set the class name of the FunctionTemplate. This is used for
668 * printing objects created with the function created from the
669 * FunctionTemplate as its constructor.
670 */
672
673 /**
674 * Set the interface name of the FunctionTemplate. This is provided as
675 * contextual information in an ExceptionPropagationMessage to the embedder.
676 */
678
679 /**
680 * Provides information on the type of FunctionTemplate for embedder
681 * exception handling.
682 */
684
685 /**
686 * When set to true, no access check will be performed on the receiver of a
687 * function call. Currently defaults to true, but this is subject to change.
688 */
689 void SetAcceptAnyReceiver(bool value);
690
691 /**
692 * Sets the ReadOnly flag in the attributes of the 'prototype' property
693 * of functions created from this FunctionTemplate to true.
694 */
696
697 /**
698 * Removes the prototype property from functions created from this
699 * FunctionTemplate.
700 */
702
703 /**
704 * Returns true if the given object is an instance of this function
705 * template.
706 */
707 bool HasInstance(Local<Value> object);
708
709 /**
710 * Returns true if the given value is an API object that was constructed by an
711 * instance of this function template (without checking for inheriting
712 * function templates).
713 *
714 * This is an experimental feature and may still change significantly.
715 */
717
718 /**
719 * Seal the object and mark it for promotion to read only space during
720 * context snapshot creation.
721 *
722 * This is an experimental feature and may still change significantly.
723 */
725
726 V8_INLINE static FunctionTemplate* Cast(Data* data);
727
728 private:
729 FunctionTemplate();
730
731 static void CheckCast(Data* that);
732 friend class Context;
733 friend class ObjectTemplate;
734};
735
736/**
737 * Configuration flags for v8::NamedPropertyHandlerConfiguration or
738 * v8::IndexedPropertyHandlerConfiguration.
739 */
741 /**
742 * None.
743 */
744 kNone = 0,
745
746 /**
747 * Will not call into interceptor for properties on the receiver or prototype
748 * chain, i.e., only call into interceptor for properties that do not exist.
749 * Currently only valid for named interceptors.
750 */
751 kNonMasking = 1,
752
753 /**
754 * Will not call into interceptor for symbol lookup. Only meaningful for
755 * named interceptors.
756 */
757 kOnlyInterceptStrings = 1 << 1,
758
759 /**
760 * The getter, query, enumerator callbacks do not produce side effects.
761 */
762 kHasNoSideEffect = 1 << 2,
763
764 /**
765 * This flag is used to distinguish which callbacks were provided -
766 * GenericNamedPropertyXXXCallback (old signature) or
767 * NamedPropertyXXXCallback (new signature).
768 * DO NOT use this flag, it'll be removed once embedders migrate to new
769 * callbacks signatures.
770 */
772};
773
775 private:
776 static constexpr PropertyHandlerFlags WithNewSignatureFlag(
777 PropertyHandlerFlags flags) {
778 return static_cast<PropertyHandlerFlags>(
779 static_cast<int>(flags) |
780 static_cast<int>(
782 }
783
784 public:
786 NamedPropertyGetterCallback getter, //
787 NamedPropertySetterCallback setter, //
788 NamedPropertyQueryCallback query, //
789 NamedPropertyDeleterCallback deleter, //
790 NamedPropertyEnumeratorCallback enumerator, //
791 NamedPropertyDefinerCallback definer, //
792 NamedPropertyDescriptorCallback descriptor, //
793 Local<Value> data = Local<Value>(),
795 : getter(getter),
796 setter(setter),
797 query(query),
798 deleter(deleter),
799 enumerator(enumerator),
800 definer(definer),
801 descriptor(descriptor),
802 data(data),
803 flags(flags) {}
804
806 NamedPropertyGetterCallback getter,
807 NamedPropertySetterCallback setter = nullptr,
808 NamedPropertyQueryCallback query = nullptr,
809 NamedPropertyDeleterCallback deleter = nullptr,
810 NamedPropertyEnumeratorCallback enumerator = nullptr,
811 Local<Value> data = Local<Value>(),
813 : getter(getter),
814 setter(setter),
815 query(query),
816 deleter(deleter),
817 enumerator(enumerator),
818 definer(nullptr),
819 descriptor(nullptr),
820 data(data),
821 flags(flags) {}
822
824 NamedPropertyGetterCallback getter, //
825 NamedPropertySetterCallback setter, //
826 NamedPropertyDescriptorCallback descriptor, //
827 NamedPropertyDeleterCallback deleter, //
828 NamedPropertyEnumeratorCallback enumerator, //
829 NamedPropertyDefinerCallback definer, //
830 Local<Value> data = Local<Value>(),
832 : getter(getter),
833 setter(setter),
834 query(nullptr),
835 deleter(deleter),
836 enumerator(enumerator),
837 definer(definer),
838 descriptor(descriptor),
839 data(data),
840 flags(flags) {}
841
842 NamedPropertyGetterCallback getter;
843 NamedPropertySetterCallback setter;
844 NamedPropertyQueryCallback query;
845 NamedPropertyDeleterCallback deleter;
846 NamedPropertyEnumeratorCallback enumerator;
847 NamedPropertyDefinerCallback definer;
848 NamedPropertyDescriptorCallback descriptor;
851};
852
854 private:
855 static constexpr PropertyHandlerFlags WithNewSignatureFlag(
856 PropertyHandlerFlags flags) {
857 return static_cast<PropertyHandlerFlags>(
858 static_cast<int>(flags) |
859 static_cast<int>(
861 }
862
863 public:
865 IndexedPropertyGetterCallbackV2 getter, //
866 IndexedPropertySetterCallbackV2 setter, //
867 IndexedPropertyQueryCallbackV2 query, //
868 IndexedPropertyDeleterCallbackV2 deleter, //
869 IndexedPropertyEnumeratorCallback enumerator, //
870 IndexedPropertyDefinerCallbackV2 definer, //
871 IndexedPropertyDescriptorCallbackV2 descriptor, //
872 Local<Value> data = Local<Value>(),
874 : getter(getter),
875 setter(setter),
876 query(query),
877 deleter(deleter),
878 enumerator(enumerator),
879 definer(definer),
880 descriptor(descriptor),
881 data(data),
882 flags(flags) {}
883
885 IndexedPropertyGetterCallbackV2 getter = nullptr,
886 IndexedPropertySetterCallbackV2 setter = nullptr,
887 IndexedPropertyQueryCallbackV2 query = nullptr,
888 IndexedPropertyDeleterCallbackV2 deleter = nullptr,
889 IndexedPropertyEnumeratorCallback enumerator = nullptr,
890 Local<Value> data = Local<Value>(),
892 : getter(getter),
893 setter(setter),
894 query(query),
895 deleter(deleter),
896 enumerator(enumerator),
897 definer(nullptr),
898 descriptor(nullptr),
899 data(data),
900 flags(flags) {}
901
903 IndexedPropertyGetterCallbackV2 getter,
904 IndexedPropertySetterCallbackV2 setter,
905 IndexedPropertyDescriptorCallbackV2 descriptor,
906 IndexedPropertyDeleterCallbackV2 deleter,
907 IndexedPropertyEnumeratorCallback enumerator,
908 IndexedPropertyDefinerCallbackV2 definer,
909 Local<Value> data = Local<Value>(),
911 : getter(getter),
912 setter(setter),
913 query(nullptr),
914 deleter(deleter),
915 enumerator(enumerator),
916 definer(definer),
917 descriptor(descriptor),
918 data(data),
919 flags(flags) {}
920
921 IndexedPropertyGetterCallbackV2 getter;
922 IndexedPropertySetterCallbackV2 setter;
923 IndexedPropertyQueryCallbackV2 query;
924 IndexedPropertyDeleterCallbackV2 deleter;
925 IndexedPropertyEnumeratorCallback enumerator;
926 IndexedPropertyDefinerCallbackV2 definer;
927 IndexedPropertyDescriptorCallbackV2 descriptor;
930};
931
932/**
933 * An ObjectTemplate is used to create objects at runtime.
934 *
935 * Properties added to an ObjectTemplate are added to each object
936 * created from the ObjectTemplate.
937 */
939 public:
940 /** Creates an ObjectTemplate. */
942 Isolate* isolate,
943 Local<FunctionTemplate> constructor = Local<FunctionTemplate>());
944
945 /**
946 * Creates a new instance of this template.
947 *
948 * \param context The context in which the instance is created.
949 */
951
952 /**
953 * Sets a named property handler on the object template.
954 *
955 * Whenever a property whose name is a string or a symbol is accessed on
956 * objects created from this object template, the provided callback is
957 * invoked instead of accessing the property directly on the JavaScript
958 * object.
959 *
960 * @param configuration The NamedPropertyHandlerConfiguration that defines the
961 * callbacks to invoke when accessing a property.
962 */
964
965 /**
966 * Sets an indexed property handler on the object template.
967 *
968 * Whenever an indexed property is accessed on objects created from
969 * this object template, the provided callback is invoked instead of
970 * accessing the property directly on the JavaScript object.
971 *
972 * @param configuration The IndexedPropertyHandlerConfiguration that defines
973 * the callbacks to invoke when accessing a property.
974 */
976
977 /**
978 * Sets the callback to be used when calling instances created from
979 * this template as a function. If no callback is set, instances
980 * behave like normal JavaScript objects that cannot be called as a
981 * function.
982 */
983 void SetCallAsFunctionHandler(FunctionCallback callback,
984 Local<Value> data = Local<Value>());
985
986 /**
987 * Mark object instances of the template as undetectable.
988 *
989 * In many ways, undetectable objects behave as though they are not
990 * there. They behave like 'undefined' in conditionals and when
991 * printed. However, properties can be accessed and called as on
992 * normal objects.
993 */
995
996 /**
997 * Sets access check callback on the object template and enables access
998 * checks.
999 *
1000 * When accessing properties on instances of this object template,
1001 * the access check callback will be called to determine whether or
1002 * not to allow cross-context access to the properties.
1003 */
1004 void SetAccessCheckCallback(AccessCheckCallback callback,
1005 Local<Value> data = Local<Value>());
1006
1007 /**
1008 * Like SetAccessCheckCallback but invokes an interceptor on failed access
1009 * checks instead of looking up all-can-read properties. You can only use
1010 * either this method or SetAccessCheckCallback, but not both at the same
1011 * time.
1012 */
1014 AccessCheckCallback callback,
1015 const NamedPropertyHandlerConfiguration& named_handler,
1016 const IndexedPropertyHandlerConfiguration& indexed_handler,
1017 Local<Value> data = Local<Value>());
1018
1019 /**
1020 * Gets the number of internal fields for objects generated from
1021 * this template.
1022 */
1024
1025 /**
1026 * Sets the number of internal fields for objects generated from
1027 * this template.
1028 */
1029 void SetInternalFieldCount(int value);
1030
1031 /**
1032 * Returns true if the object will be an immutable prototype exotic object.
1033 */
1034 bool IsImmutableProto() const;
1035
1036 /**
1037 * Makes the ObjectTemplate for an immutable prototype exotic object, with an
1038 * immutable __proto__.
1039 */
1041
1042 /**
1043 * Support for TC39 "dynamic code brand checks" proposal.
1044 *
1045 * This API allows to mark (& query) objects as "code like", which causes
1046 * them to be treated like Strings in the context of eval and function
1047 * constructor.
1048 *
1049 * Reference: https://github.com/tc39/proposal-dynamic-code-brand-checks
1050 */
1052 bool IsCodeLike() const;
1053
1054 /**
1055 * Seal the object and mark it for promotion to read only space during
1056 * context snapshot creation.
1057 *
1058 * This is an experimental feature and may still change significantly.
1059 */
1061
1062 V8_INLINE static ObjectTemplate* Cast(Data* data);
1063
1064 private:
1065 ObjectTemplate();
1066
1067 static void CheckCast(Data* that);
1068 friend class FunctionTemplate;
1069};
1070
1071/**
1072 * A template to create dictionary objects at runtime.
1073 */
1074class V8_EXPORT DictionaryTemplate final {
1075 public:
1076 /** Creates a new template. Also declares data properties that can be passed
1077 * on instantiation of the template. Properties can only be declared on
1078 * construction and are then immutable. The values are passed on creating the
1079 * object via `NewInstance()`.
1080 *
1081 * \param names the keys that can be passed on instantiation.
1082 */
1083 static Local<DictionaryTemplate> New(
1084 Isolate* isolate, MemorySpan<const std::string_view> names);
1085
1086 /**
1087 * Creates a new instance of this template.
1088 *
1089 * \param context The context used to create the dictionary object.
1090 * \param property_values Values of properties that were declared using
1091 * `DeclareDataProperties()`. The span only passes values and expectes the
1092 * order to match the declaration. Non-existent properties are signaled via
1093 * empty `MaybeLocal`s.
1094 */
1096 Local<Context> context, MemorySpan<MaybeLocal<Value>> property_values);
1097
1098 V8_INLINE static DictionaryTemplate* Cast(Data* data);
1099
1100 private:
1101 static void CheckCast(Data* that);
1102
1103 DictionaryTemplate();
1104};
1105
1106/**
1107 * A Signature specifies which receiver is valid for a function.
1108 *
1109 * A receiver matches a given signature if the receiver (or any of its
1110 * hidden prototypes) was created from the signature's FunctionTemplate, or
1111 * from a FunctionTemplate that inherits directly or indirectly from the
1112 * signature's FunctionTemplate.
1113 */
1114class V8_EXPORT Signature : public Data {
1115 public:
1117 Isolate* isolate,
1118 Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
1119
1120 V8_INLINE static Signature* Cast(Data* data);
1121
1122 private:
1123 Signature();
1124
1125 static void CheckCast(Data* that);
1126};
1127
1128// --- Implementation ---
1129
1130void Template::Set(Isolate* isolate, const char* name, Local<Data> value,
1131 PropertyAttribute attributes) {
1133 .ToLocalChecked(),
1134 value, attributes);
1135}
1136
1138#ifdef V8_ENABLE_CHECKS
1139 CheckCast(data);
1140#endif
1141 return reinterpret_cast<FunctionTemplate*>(data);
1142}
1143
1145#ifdef V8_ENABLE_CHECKS
1146 CheckCast(data);
1147#endif
1148 return reinterpret_cast<ObjectTemplate*>(data);
1149}
1150
1151DictionaryTemplate* DictionaryTemplate::Cast(Data* data) {
1152#ifdef V8_ENABLE_CHECKS
1153 CheckCast(data);
1154#endif
1155 return reinterpret_cast<DictionaryTemplate*>(data);
1156}
1157
1159#ifdef V8_ENABLE_CHECKS
1160 CheckCast(data);
1161#endif
1162 return reinterpret_cast<Signature*>(data);
1163}
1164
1165} // namespace v8
1166
1167#endif // INCLUDE_V8_TEMPLATE_H_
V8_WARN_UNUSED_RESULT Local< Object > NewInstance(Local< Context > context, MemorySpan< MaybeLocal< Value > > property_values)
static Local< DictionaryTemplate > New(Isolate *isolate, MemorySpan< const std::string_view > names)
static V8_INLINE DictionaryTemplate * Cast(Data *data)
bool HasInstance(Local< Value > object)
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const CFunction *c_function=nullptr, uint16_t instance_type=0, uint16_t allowed_receiver_instance_type_range_start=0, uint16_t allowed_receiver_instance_type_range_end=0)
void SealAndPrepareForPromotionToReadOnly()
static Local< FunctionTemplate > NewWithCache(Isolate *isolate, FunctionCallback callback, Local< Private > cache_property, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
void SetCallHandler(FunctionCallback callback, Local< Value > data=Local< Value >(), SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const MemorySpan< const CFunction > &c_function_overloads={})
void SetExceptionContext(ExceptionContext context)
static Local< FunctionTemplate > NewWithCFunctionOverloads(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const MemorySpan< const CFunction > &c_function_overloads={})
Local< ObjectTemplate > InstanceTemplate()
void SetInterfaceName(Local< String > name)
void SetLength(int length)
bool IsLeafTemplateForApiObject(v8::Local< v8::Value > value) const
Local< ObjectTemplate > PrototypeTemplate()
void Inherit(Local< FunctionTemplate > parent)
V8_WARN_UNUSED_RESULT MaybeLocal< Function > GetFunction(Local< Context > context)
static V8_INLINE FunctionTemplate * Cast(Data *data)
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewRemoteInstance()
void SetPrototypeProviderTemplate(Local< FunctionTemplate > prototype_provider)
void SetClassName(Local< String > name)
void SetAcceptAnyReceiver(bool value)
friend class Local
friend class MaybeLocal
void SetHandler(const NamedPropertyHandlerConfiguration &configuration)
void SetInternalFieldCount(int value)
static Local< ObjectTemplate > New(Isolate *isolate, Local< FunctionTemplate > constructor=Local< FunctionTemplate >())
bool IsCodeLike() const
void SetCallAsFunctionHandler(FunctionCallback callback, Local< Value > data=Local< Value >())
void SealAndPrepareForPromotionToReadOnly()
void SetAccessCheckCallbackAndHandler(AccessCheckCallback callback, const NamedPropertyHandlerConfiguration &named_handler, const IndexedPropertyHandlerConfiguration &indexed_handler, Local< Value > data=Local< Value >())
void SetAccessCheckCallback(AccessCheckCallback callback, Local< Value > data=Local< Value >())
bool IsImmutableProto() const
void SetHandler(const IndexedPropertyHandlerConfiguration &configuration)
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context)
static V8_INLINE ObjectTemplate * Cast(Data *data)
int InternalFieldCount() const
static V8_INLINE Signature * Cast(Data *data)
static Local< Signature > New(Isolate *isolate, Local< FunctionTemplate > receiver=Local< FunctionTemplate >())
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=NewStringType::kNormal, int length=-1)
void SetNativeDataProperty(Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
V8_INLINE void Set(Isolate *isolate, const char *name, Local< Data > value, PropertyAttribute attributes=None)
void SetIntrinsicDataProperty(Local< Name > name, Intrinsic intrinsic, PropertyAttribute attribute=None)
void SetPrivate(Local< Private > name, Local< Data > value, PropertyAttribute attributes=None)
void SetLazyDataProperty(Local< Name > name, AccessorNameGetterCallback getter, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
void Set(Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
void SetAccessorProperty(Local< Name > name, Local< FunctionTemplate > getter=Local< FunctionTemplate >(), Local< FunctionTemplate > setter=Local< FunctionTemplate >(), PropertyAttribute attribute=None)
Intrinsic
Definition v8-template.h:41
Intercepted
SideEffectType
Definition v8-object.h:208
PropertyAttribute
Definition v8-object.h:149
@ None
Definition v8-object.h:151
ConstructorBehavior
ExceptionContext
NewStringType
PropertyHandlerFlags
IndexedPropertyQueryCallbackV2 query
IndexedPropertyDefinerCallbackV2 definer
IndexedPropertySetterCallbackV2 setter
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallbackV2 getter=nullptr, IndexedPropertySetterCallbackV2 setter=nullptr, IndexedPropertyQueryCallbackV2 query=nullptr, IndexedPropertyDeleterCallbackV2 deleter=nullptr, IndexedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
IndexedPropertyGetterCallbackV2 getter
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallbackV2 getter, IndexedPropertySetterCallbackV2 setter, IndexedPropertyDescriptorCallbackV2 descriptor, IndexedPropertyDeleterCallbackV2 deleter, IndexedPropertyEnumeratorCallback enumerator, IndexedPropertyDefinerCallbackV2 definer, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
IndexedPropertyDeleterCallbackV2 deleter
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallbackV2 getter, IndexedPropertySetterCallbackV2 setter, IndexedPropertyQueryCallbackV2 query, IndexedPropertyDeleterCallbackV2 deleter, IndexedPropertyEnumeratorCallback enumerator, IndexedPropertyDefinerCallbackV2 definer, IndexedPropertyDescriptorCallbackV2 descriptor, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
IndexedPropertyDescriptorCallbackV2 descriptor
IndexedPropertyEnumeratorCallback enumerator
NamedPropertyDeleterCallback deleter
NamedPropertySetterCallback setter
NamedPropertyDescriptorCallback descriptor
NamedPropertyHandlerConfiguration(NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter, NamedPropertyDescriptorCallback descriptor, NamedPropertyDeleterCallback deleter, NamedPropertyEnumeratorCallback enumerator, NamedPropertyDefinerCallback definer, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
NamedPropertyQueryCallback query
NamedPropertyEnumeratorCallback enumerator
NamedPropertyDefinerCallback definer
NamedPropertyHandlerConfiguration(NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter, NamedPropertyQueryCallback query, NamedPropertyDeleterCallback deleter, NamedPropertyEnumeratorCallback enumerator, NamedPropertyDefinerCallback definer, NamedPropertyDescriptorCallback descriptor, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
NamedPropertyGetterCallback getter
NamedPropertyHandlerConfiguration(NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter=nullptr, NamedPropertyQueryCallback query=nullptr, NamedPropertyDeleterCallback deleter=nullptr, NamedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
#define V8_INTRINSICS_LIST(F)
Definition v8-template.h:28
#define V8_EXPORT
Definition v8config.h:860
#define V8_INLINE
Definition v8config.h:513
#define V8_DEPRECATE_SOON(message)
Definition v8config.h:627
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:684