libv8-node 21.7.2.0-aarch64-linux-musl → 22.5.1.0-aarch64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +1 -1
- data/vendor/v8/include/cppgc/type-traits.h +25 -4
- data/vendor/v8/include/v8-array-buffer.h +6 -0
- data/vendor/v8/include/v8-callbacks.h +6 -12
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +51 -22
- data/vendor/v8/include/v8-embedder-heap.h +19 -3
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +15 -9
- data/vendor/v8/include/v8-fast-api-calls.h +35 -26
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +129 -20
- data/vendor/v8/include/v8-handle-base.h +32 -80
- data/vendor/v8/include/v8-inspector.h +16 -24
- data/vendor/v8/include/v8-internal.h +472 -65
- data/vendor/v8/include/v8-isolate.h +86 -51
- data/vendor/v8/include/v8-local-handle.h +257 -31
- data/vendor/v8/include/v8-memory-span.h +157 -2
- data/vendor/v8/include/v8-message.h +22 -3
- data/vendor/v8/include/v8-metrics.h +1 -0
- data/vendor/v8/include/v8-object.h +29 -10
- data/vendor/v8/include/v8-persistent-handle.h +5 -3
- data/vendor/v8/include/v8-platform.h +81 -44
- data/vendor/v8/include/v8-script.h +61 -11
- data/vendor/v8/include/v8-snapshot.h +94 -23
- data/vendor/v8/include/v8-statistics.h +10 -24
- data/vendor/v8/include/v8-template.h +410 -131
- data/vendor/v8/include/v8-traced-handle.h +81 -46
- data/vendor/v8/include/v8-typed-array.h +115 -7
- data/vendor/v8/include/v8-util.h +13 -12
- data/vendor/v8/include/v8-value.h +92 -4
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8config.h +35 -10
- metadata +2 -2
@@ -5,6 +5,9 @@
|
|
5
5
|
#ifndef INCLUDE_V8_TEMPLATE_H_
|
6
6
|
#define INCLUDE_V8_TEMPLATE_H_
|
7
7
|
|
8
|
+
#include <cstddef>
|
9
|
+
#include <string_view>
|
10
|
+
|
8
11
|
#include "v8-data.h" // NOLINT(build/include_directory)
|
9
12
|
#include "v8-function-callback.h" // NOLINT(build/include_directory)
|
10
13
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
@@ -61,7 +64,7 @@ class V8_EXPORT Template : public Data {
|
|
61
64
|
Local<Name> name,
|
62
65
|
Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
|
63
66
|
Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
|
64
|
-
PropertyAttribute attribute = None
|
67
|
+
PropertyAttribute attribute = None);
|
65
68
|
|
66
69
|
/**
|
67
70
|
* Whenever the property with the given name is accessed on objects
|
@@ -74,29 +77,34 @@ class V8_EXPORT Template : public Data {
|
|
74
77
|
* \param setter The callback to invoke when setting the property.
|
75
78
|
* \param data A piece of data that will be passed to the getter and setter
|
76
79
|
* callbacks whenever they are invoked.
|
77
|
-
* \param settings Access control settings for the accessor. This is a bit
|
78
|
-
* field consisting of one of more of
|
79
|
-
* DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
|
80
|
-
* The default is to not allow cross-context access.
|
81
|
-
* ALL_CAN_READ means that all cross-context reads are allowed.
|
82
|
-
* ALL_CAN_WRITE means that all cross-context writes are allowed.
|
83
|
-
* The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
|
84
|
-
* cross-context access.
|
85
80
|
* \param attribute The attributes of the property for which an accessor
|
86
81
|
* is added.
|
87
82
|
*/
|
83
|
+
V8_DEPRECATE_SOON("Use SetNativeDataProperty without AccessControl instead")
|
84
|
+
void SetNativeDataProperty(
|
85
|
+
Local<String> name, AccessorGetterCallback getter,
|
86
|
+
AccessorSetterCallback setter, Local<Value> data,
|
87
|
+
PropertyAttribute attribute, AccessControl settings,
|
88
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
89
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
90
|
+
V8_DEPRECATE_SOON("Use SetNativeDataProperty without AccessControl instead")
|
91
|
+
void SetNativeDataProperty(
|
92
|
+
Local<Name> name, AccessorNameGetterCallback getter,
|
93
|
+
AccessorNameSetterCallback setter, Local<Value> data,
|
94
|
+
PropertyAttribute attribute, AccessControl settings,
|
95
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
96
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
97
|
+
V8_DEPRECATE_SOON("Use SetNativeDataProperty with Local<Name> instead")
|
88
98
|
void SetNativeDataProperty(
|
89
99
|
Local<String> name, AccessorGetterCallback getter,
|
90
100
|
AccessorSetterCallback setter = nullptr,
|
91
101
|
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
92
|
-
AccessControl settings = DEFAULT,
|
93
102
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
94
103
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
95
104
|
void SetNativeDataProperty(
|
96
105
|
Local<Name> name, AccessorNameGetterCallback getter,
|
97
106
|
AccessorNameSetterCallback setter = nullptr,
|
98
107
|
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
99
|
-
AccessControl settings = DEFAULT,
|
100
108
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
101
109
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
102
110
|
|
@@ -124,27 +132,35 @@ class V8_EXPORT Template : public Data {
|
|
124
132
|
friend class FunctionTemplate;
|
125
133
|
};
|
126
134
|
|
127
|
-
|
128
|
-
|
135
|
+
/**
|
136
|
+
* Interceptor callbacks use this value to indicate whether the request was
|
137
|
+
* intercepted or not.
|
138
|
+
*/
|
139
|
+
enum class Intercepted : uint8_t { kNo = 0, kYes = 1 };
|
129
140
|
|
130
141
|
/**
|
131
142
|
* Interceptor for get requests on an object.
|
132
143
|
*
|
133
|
-
*
|
134
|
-
*
|
135
|
-
*
|
144
|
+
* If the interceptor handles the request (i.e. the property should not be
|
145
|
+
* looked up beyond the interceptor) it should
|
146
|
+
* - (optionally) use info.GetReturnValue().Set()` to set the return value
|
147
|
+
* (by default the result is set to v8::Undefined),
|
148
|
+
* - return `Intercepted::kYes`.
|
149
|
+
* If the interceptor does not handle the request it must return
|
150
|
+
* `Intercepted::kNo` and it must not produce side effects.
|
136
151
|
*
|
137
152
|
* \param property The name of the property for which the request was
|
138
153
|
* intercepted.
|
139
154
|
* \param info Information about the intercepted request, such as
|
140
|
-
* isolate, receiver, return value, or whether running in `'use strict`
|
155
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
141
156
|
* See `PropertyCallbackInfo`.
|
142
157
|
*
|
143
158
|
* \code
|
144
|
-
*
|
145
|
-
*
|
146
|
-
*
|
147
|
-
*
|
159
|
+
* Intercepted GetterCallback(
|
160
|
+
* Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
161
|
+
* if (!IsKnownProperty(info.GetIsolate(), name)) return Intercepted::kNo;
|
162
|
+
* info.GetReturnValue().Set(v8_num(42));
|
163
|
+
* return Intercepted::kYes;
|
148
164
|
* }
|
149
165
|
*
|
150
166
|
* v8::Local<v8::FunctionTemplate> templ =
|
@@ -164,18 +180,23 @@ class V8_EXPORT Template : public Data {
|
|
164
180
|
*
|
165
181
|
* See also `ObjectTemplate::SetHandler`.
|
166
182
|
*/
|
183
|
+
using NamedPropertyGetterCallback = Intercepted (*)(
|
184
|
+
Local<Name> property, const PropertyCallbackInfo<Value>& info);
|
185
|
+
// This variant will be deprecated soon.
|
186
|
+
//
|
187
|
+
// Use `info.GetReturnValue().Set()` to set the return value of the
|
188
|
+
// intercepted get request. If the property does not exist the callback should
|
189
|
+
// not set the result and must not produce side effects.
|
167
190
|
using GenericNamedPropertyGetterCallback =
|
168
191
|
void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
|
169
192
|
|
170
193
|
/**
|
171
194
|
* Interceptor for set requests on an object.
|
172
195
|
*
|
173
|
-
*
|
174
|
-
*
|
175
|
-
*
|
176
|
-
* `
|
177
|
-
* request, i.e., if the request should be handled as if no interceptor is
|
178
|
-
* present, do not not call `Set()` and do not produce side effects.
|
196
|
+
* If the interceptor handles the request (i.e. the property should not be
|
197
|
+
* looked up beyond the interceptor) it should return `Intercepted::kYes`.
|
198
|
+
* If the interceptor does not handle the request it must return
|
199
|
+
* `Intercepted::kNo` and it must not produce side effects.
|
179
200
|
*
|
180
201
|
* \param property The name of the property for which the request was
|
181
202
|
* intercepted.
|
@@ -185,9 +206,19 @@ using GenericNamedPropertyGetterCallback =
|
|
185
206
|
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
186
207
|
* See `PropertyCallbackInfo`.
|
187
208
|
*
|
188
|
-
* See also
|
189
|
-
* `ObjectTemplate::SetHandler.`
|
209
|
+
* See also `ObjectTemplate::SetHandler.`
|
190
210
|
*/
|
211
|
+
using NamedPropertySetterCallback =
|
212
|
+
Intercepted (*)(Local<Name> property, Local<Value> value,
|
213
|
+
const PropertyCallbackInfo<void>& info);
|
214
|
+
// This variant will be deprecated soon.
|
215
|
+
//
|
216
|
+
// Use `info.GetReturnValue()` to indicate whether the request was intercepted
|
217
|
+
// or not. If the setter successfully intercepts the request, i.e., if the
|
218
|
+
// request should not be further executed, call
|
219
|
+
// `info.GetReturnValue().Set(value)`. If the setter did not intercept the
|
220
|
+
// request, i.e., if the request should be handled as if no interceptor is
|
221
|
+
// present, do not not call `Set()` and do not produce side effects.
|
191
222
|
using GenericNamedPropertySetterCallback =
|
192
223
|
void (*)(Local<Name> property, Local<Value> value,
|
193
224
|
const PropertyCallbackInfo<Value>& info);
|
@@ -197,10 +228,13 @@ using GenericNamedPropertySetterCallback =
|
|
197
228
|
* property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and
|
198
229
|
* defineProperty().
|
199
230
|
*
|
200
|
-
*
|
201
|
-
*
|
202
|
-
*
|
203
|
-
*
|
231
|
+
* If the interceptor handles the request (i.e. the property should not be
|
232
|
+
* looked up beyond the interceptor) it should
|
233
|
+
* - use `info.GetReturnValue().Set()` to set to an Integer value encoding
|
234
|
+
* a `v8::PropertyAttribute` bits,
|
235
|
+
* - return `Intercepted::kYes`.
|
236
|
+
* If the interceptor does not handle the request it must return
|
237
|
+
* `Intercepted::kNo` and it must not produce side effects.
|
204
238
|
*
|
205
239
|
* \param property The name of the property for which the request was
|
206
240
|
* intercepted.
|
@@ -212,21 +246,29 @@ using GenericNamedPropertySetterCallback =
|
|
212
246
|
* they do not return the attributes. For example, `hasOwnProperty()` can
|
213
247
|
* trigger this interceptor depending on the state of the object.
|
214
248
|
*
|
215
|
-
* See also
|
216
|
-
* `ObjectTemplate::SetHandler.`
|
249
|
+
* See also `ObjectTemplate::SetHandler.`
|
217
250
|
*/
|
251
|
+
using NamedPropertyQueryCallback = Intercepted (*)(
|
252
|
+
Local<Name> property, const PropertyCallbackInfo<Integer>& info);
|
253
|
+
// This variant will be deprecated soon.
|
254
|
+
//
|
255
|
+
// Use `info.GetReturnValue().Set(value)` to set the property attributes. The
|
256
|
+
// value is an integer encoding a `v8::PropertyAttribute`. If the property does
|
257
|
+
// not exist the callback should not set the result and must not produce side
|
258
|
+
// effects.
|
218
259
|
using GenericNamedPropertyQueryCallback =
|
219
260
|
void (*)(Local<Name> property, const PropertyCallbackInfo<Integer>& info);
|
220
261
|
|
221
262
|
/**
|
222
263
|
* Interceptor for delete requests on an object.
|
223
264
|
*
|
224
|
-
*
|
225
|
-
*
|
226
|
-
*
|
227
|
-
*
|
228
|
-
*
|
229
|
-
*
|
265
|
+
* If the interceptor handles the request (i.e. the property should not be
|
266
|
+
* looked up beyond the interceptor) it should
|
267
|
+
* - use `info.GetReturnValue().Set()` to set to a Boolean value indicating
|
268
|
+
* whether the property deletion was successful or not,
|
269
|
+
* - return `Intercepted::kYes`.
|
270
|
+
* If the interceptor does not handle the request it must return
|
271
|
+
* `Intercepted::kNo` and it must not produce side effects.
|
230
272
|
*
|
231
273
|
* \param property The name of the property for which the request was
|
232
274
|
* intercepted.
|
@@ -240,6 +282,16 @@ using GenericNamedPropertyQueryCallback =
|
|
240
282
|
*
|
241
283
|
* See also `ObjectTemplate::SetHandler.`
|
242
284
|
*/
|
285
|
+
using NamedPropertyDeleterCallback = Intercepted (*)(
|
286
|
+
Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
|
287
|
+
// This variant will be deprecated soon.
|
288
|
+
//
|
289
|
+
// Use `info.GetReturnValue()` to indicate whether the request was intercepted
|
290
|
+
// or not. If the deleter successfully intercepts the request, i.e., if the
|
291
|
+
// request should not be further executed, call
|
292
|
+
// `info.GetReturnValue().Set(value)` with a boolean `value`. The `value` is
|
293
|
+
// used as the return value of `delete`. If the deleter does not intercept the
|
294
|
+
// request then it should not set the result and must not produce side effects.
|
243
295
|
using GenericNamedPropertyDeleterCallback =
|
244
296
|
void (*)(Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
|
245
297
|
|
@@ -249,18 +301,19 @@ using GenericNamedPropertyDeleterCallback =
|
|
249
301
|
*
|
250
302
|
* Note: The values in the array must be of type v8::Name.
|
251
303
|
*/
|
252
|
-
using
|
304
|
+
using NamedPropertyEnumeratorCallback =
|
253
305
|
void (*)(const PropertyCallbackInfo<Array>& info);
|
306
|
+
// This variant will be deprecated soon.
|
307
|
+
// This is just a renaming of the typedef.
|
308
|
+
using GenericNamedPropertyEnumeratorCallback = NamedPropertyEnumeratorCallback;
|
254
309
|
|
255
310
|
/**
|
256
311
|
* Interceptor for defineProperty requests on an object.
|
257
312
|
*
|
258
|
-
*
|
259
|
-
*
|
260
|
-
*
|
261
|
-
* `
|
262
|
-
* request, i.e., if the request should be handled as if no interceptor is
|
263
|
-
* present, do not not call `Set()` and do not produce side effects.
|
313
|
+
* If the interceptor handles the request (i.e. the property should not be
|
314
|
+
* looked up beyond the interceptor) it should return `Intercepted::kYes`.
|
315
|
+
* If the interceptor does not handle the request it must return
|
316
|
+
* `Intercepted::kNo` and it must not produce side effects.
|
264
317
|
*
|
265
318
|
* \param property The name of the property for which the request was
|
266
319
|
* intercepted.
|
@@ -272,6 +325,17 @@ using GenericNamedPropertyEnumeratorCallback =
|
|
272
325
|
*
|
273
326
|
* See also `ObjectTemplate::SetHandler`.
|
274
327
|
*/
|
328
|
+
using NamedPropertyDefinerCallback =
|
329
|
+
Intercepted (*)(Local<Name> property, const PropertyDescriptor& desc,
|
330
|
+
const PropertyCallbackInfo<void>& info);
|
331
|
+
// This variant will be deprecated soon.
|
332
|
+
//
|
333
|
+
// Use `info.GetReturnValue()` to indicate whether the request was intercepted
|
334
|
+
// or not. If the definer successfully intercepts the request, i.e., if the
|
335
|
+
// request should not be further executed, call
|
336
|
+
// `info.GetReturnValue().Set(value)`. If the definer did not intercept the
|
337
|
+
// request, i.e., if the request should be handled as if no interceptor is
|
338
|
+
// present, do not not call `Set()` and do not produce side effects.
|
275
339
|
using GenericNamedPropertyDefinerCallback =
|
276
340
|
void (*)(Local<Name> property, const PropertyDescriptor& desc,
|
277
341
|
const PropertyCallbackInfo<Value>& info);
|
@@ -279,10 +343,14 @@ using GenericNamedPropertyDefinerCallback =
|
|
279
343
|
/**
|
280
344
|
* Interceptor for getOwnPropertyDescriptor requests on an object.
|
281
345
|
*
|
282
|
-
*
|
283
|
-
*
|
284
|
-
*
|
285
|
-
*
|
346
|
+
* If the interceptor handles the request (i.e. the property should not be
|
347
|
+
* looked up beyond the interceptor) it should
|
348
|
+
* - use `info.GetReturnValue().Set()` to set the return value which must be
|
349
|
+
* object that can be converted to a PropertyDescriptor (for example,
|
350
|
+
* a value returned by `v8::Object::getOwnPropertyDescriptor`),
|
351
|
+
* - return `Intercepted::kYes`.
|
352
|
+
* If the interceptor does not handle the request it must return
|
353
|
+
* `Intercepted::kNo` and it must not produce side effects.
|
286
354
|
*
|
287
355
|
* \param property The name of the property for which the request was
|
288
356
|
* intercepted.
|
@@ -295,18 +363,36 @@ using GenericNamedPropertyDefinerCallback =
|
|
295
363
|
*
|
296
364
|
* See also `ObjectTemplate::SetHandler`.
|
297
365
|
*/
|
366
|
+
using NamedPropertyDescriptorCallback = Intercepted (*)(
|
367
|
+
Local<Name> property, const PropertyCallbackInfo<Value>& info);
|
368
|
+
// This variant will be deprecated soon.
|
369
|
+
//
|
370
|
+
// Use `info.GetReturnValue().Set()` to set the return value of the
|
371
|
+
// intercepted request. The return value must be an object that
|
372
|
+
// can be converted to a PropertyDescriptor, e.g., a `v8::Value` returned from
|
373
|
+
// `v8::Object::getOwnPropertyDescriptor`.
|
298
374
|
using GenericNamedPropertyDescriptorCallback =
|
299
375
|
void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
|
300
376
|
|
377
|
+
// TODO(ishell): Rename IndexedPropertyXxxCallbackV2 back to
|
378
|
+
// IndexedPropertyXxxCallback once the old IndexedPropertyXxxCallback is
|
379
|
+
// removed.
|
380
|
+
|
301
381
|
/**
|
302
382
|
* See `v8::GenericNamedPropertyGetterCallback`.
|
303
383
|
*/
|
384
|
+
using IndexedPropertyGetterCallbackV2 =
|
385
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
386
|
+
// This variant will be deprecated soon.
|
304
387
|
using IndexedPropertyGetterCallback =
|
305
388
|
void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
306
389
|
|
307
390
|
/**
|
308
391
|
* See `v8::GenericNamedPropertySetterCallback`.
|
309
392
|
*/
|
393
|
+
using IndexedPropertySetterCallbackV2 = Intercepted (*)(
|
394
|
+
uint32_t index, Local<Value> value, const PropertyCallbackInfo<void>& info);
|
395
|
+
// This variant will be deprecated soon.
|
310
396
|
using IndexedPropertySetterCallback =
|
311
397
|
void (*)(uint32_t index, Local<Value> value,
|
312
398
|
const PropertyCallbackInfo<Value>& info);
|
@@ -314,12 +400,18 @@ using IndexedPropertySetterCallback =
|
|
314
400
|
/**
|
315
401
|
* See `v8::GenericNamedPropertyQueryCallback`.
|
316
402
|
*/
|
403
|
+
using IndexedPropertyQueryCallbackV2 =
|
404
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
|
405
|
+
// This variant will be deprecated soon.
|
317
406
|
using IndexedPropertyQueryCallback =
|
318
407
|
void (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
|
319
408
|
|
320
409
|
/**
|
321
410
|
* See `v8::GenericNamedPropertyDeleterCallback`.
|
322
411
|
*/
|
412
|
+
using IndexedPropertyDeleterCallbackV2 =
|
413
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
|
414
|
+
// This variant will be deprecated soon.
|
323
415
|
using IndexedPropertyDeleterCallback =
|
324
416
|
void (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
|
325
417
|
|
@@ -335,6 +427,10 @@ using IndexedPropertyEnumeratorCallback =
|
|
335
427
|
/**
|
336
428
|
* See `v8::GenericNamedPropertyDefinerCallback`.
|
337
429
|
*/
|
430
|
+
using IndexedPropertyDefinerCallbackV2 =
|
431
|
+
Intercepted (*)(uint32_t index, const PropertyDescriptor& desc,
|
432
|
+
const PropertyCallbackInfo<void>& info);
|
433
|
+
// This variant will be deprecated soon.
|
338
434
|
using IndexedPropertyDefinerCallback =
|
339
435
|
void (*)(uint32_t index, const PropertyDescriptor& desc,
|
340
436
|
const PropertyCallbackInfo<Value>& info);
|
@@ -342,6 +438,9 @@ using IndexedPropertyDefinerCallback =
|
|
342
438
|
/**
|
343
439
|
* See `v8::GenericNamedPropertyDescriptorCallback`.
|
344
440
|
*/
|
441
|
+
using IndexedPropertyDescriptorCallbackV2 =
|
442
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
443
|
+
// This variant will be deprecated soon.
|
345
444
|
using IndexedPropertyDescriptorCallback =
|
346
445
|
void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
347
446
|
|
@@ -605,29 +704,65 @@ enum class PropertyHandlerFlags {
|
|
605
704
|
kNone = 0,
|
606
705
|
|
607
706
|
/**
|
608
|
-
*
|
609
|
-
*/
|
610
|
-
kAllCanRead = 1,
|
611
|
-
|
612
|
-
/** Will not call into interceptor for properties on the receiver or prototype
|
707
|
+
* Will not call into interceptor for properties on the receiver or prototype
|
613
708
|
* chain, i.e., only call into interceptor for properties that do not exist.
|
614
709
|
* Currently only valid for named interceptors.
|
615
710
|
*/
|
616
|
-
kNonMasking = 1
|
711
|
+
kNonMasking = 1,
|
617
712
|
|
618
713
|
/**
|
619
714
|
* Will not call into interceptor for symbol lookup. Only meaningful for
|
620
715
|
* named interceptors.
|
621
716
|
*/
|
622
|
-
kOnlyInterceptStrings = 1 <<
|
717
|
+
kOnlyInterceptStrings = 1 << 1,
|
623
718
|
|
624
719
|
/**
|
625
720
|
* The getter, query, enumerator callbacks do not produce side effects.
|
626
721
|
*/
|
627
|
-
kHasNoSideEffect = 1 <<
|
722
|
+
kHasNoSideEffect = 1 << 2,
|
723
|
+
|
724
|
+
/**
|
725
|
+
* This flag is used to distinguish which callbacks were provided -
|
726
|
+
* GenericNamedPropertyXXXCallback (old signature) or
|
727
|
+
* NamedPropertyXXXCallback (new signature).
|
728
|
+
* DO NOT use this flag, it'll be removed once embedders migrate to new
|
729
|
+
* callbacks signatures.
|
730
|
+
*/
|
731
|
+
kInternalNewCallbacksSignatures = 1 << 10,
|
628
732
|
};
|
629
733
|
|
630
734
|
struct NamedPropertyHandlerConfiguration {
|
735
|
+
private:
|
736
|
+
static constexpr PropertyHandlerFlags WithNewSignatureFlag(
|
737
|
+
PropertyHandlerFlags flags) {
|
738
|
+
return static_cast<PropertyHandlerFlags>(
|
739
|
+
static_cast<int>(flags) |
|
740
|
+
static_cast<int>(
|
741
|
+
PropertyHandlerFlags::kInternalNewCallbacksSignatures));
|
742
|
+
}
|
743
|
+
|
744
|
+
public:
|
745
|
+
NamedPropertyHandlerConfiguration(
|
746
|
+
NamedPropertyGetterCallback getter, //
|
747
|
+
NamedPropertySetterCallback setter, //
|
748
|
+
NamedPropertyQueryCallback query, //
|
749
|
+
NamedPropertyDeleterCallback deleter, //
|
750
|
+
NamedPropertyEnumeratorCallback enumerator, //
|
751
|
+
NamedPropertyDefinerCallback definer, //
|
752
|
+
NamedPropertyDescriptorCallback descriptor, //
|
753
|
+
Local<Value> data = Local<Value>(),
|
754
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
755
|
+
: getter(reinterpret_cast<void*>(getter)),
|
756
|
+
setter(reinterpret_cast<void*>(setter)),
|
757
|
+
query(reinterpret_cast<void*>(query)),
|
758
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
759
|
+
enumerator(enumerator),
|
760
|
+
definer(reinterpret_cast<void*>(definer)),
|
761
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
762
|
+
data(data),
|
763
|
+
flags(WithNewSignatureFlag(flags)) {}
|
764
|
+
|
765
|
+
// This variant will be deprecated soon.
|
631
766
|
NamedPropertyHandlerConfiguration(
|
632
767
|
GenericNamedPropertyGetterCallback getter,
|
633
768
|
GenericNamedPropertySetterCallback setter,
|
@@ -638,35 +773,73 @@ struct NamedPropertyHandlerConfiguration {
|
|
638
773
|
GenericNamedPropertyDescriptorCallback descriptor,
|
639
774
|
Local<Value> data = Local<Value>(),
|
640
775
|
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
641
|
-
: getter(getter),
|
642
|
-
setter(setter),
|
643
|
-
query(query),
|
644
|
-
deleter(deleter),
|
776
|
+
: getter(reinterpret_cast<void*>(getter)),
|
777
|
+
setter(reinterpret_cast<void*>(setter)),
|
778
|
+
query(reinterpret_cast<void*>(query)),
|
779
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
645
780
|
enumerator(enumerator),
|
646
|
-
definer(definer),
|
647
|
-
descriptor(descriptor),
|
781
|
+
definer(reinterpret_cast<void*>(definer)),
|
782
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
648
783
|
data(data),
|
649
784
|
flags(flags) {}
|
650
785
|
|
651
|
-
NamedPropertyHandlerConfiguration(
|
652
|
-
|
653
|
-
|
786
|
+
explicit NamedPropertyHandlerConfiguration(
|
787
|
+
NamedPropertyGetterCallback getter,
|
788
|
+
NamedPropertySetterCallback setter = nullptr,
|
789
|
+
NamedPropertyQueryCallback query = nullptr,
|
790
|
+
NamedPropertyDeleterCallback deleter = nullptr,
|
791
|
+
NamedPropertyEnumeratorCallback enumerator = nullptr,
|
792
|
+
Local<Value> data = Local<Value>(),
|
793
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
794
|
+
: getter(reinterpret_cast<void*>(getter)),
|
795
|
+
setter(reinterpret_cast<void*>(setter)),
|
796
|
+
query(reinterpret_cast<void*>(query)),
|
797
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
798
|
+
enumerator(enumerator),
|
799
|
+
definer(nullptr),
|
800
|
+
descriptor(nullptr),
|
801
|
+
data(data),
|
802
|
+
flags(WithNewSignatureFlag(flags)) {}
|
803
|
+
|
804
|
+
// This variant will be deprecated soon.
|
805
|
+
explicit NamedPropertyHandlerConfiguration(
|
806
|
+
GenericNamedPropertyGetterCallback getter,
|
654
807
|
GenericNamedPropertySetterCallback setter = nullptr,
|
655
808
|
GenericNamedPropertyQueryCallback query = nullptr,
|
656
809
|
GenericNamedPropertyDeleterCallback deleter = nullptr,
|
657
810
|
GenericNamedPropertyEnumeratorCallback enumerator = nullptr,
|
658
811
|
Local<Value> data = Local<Value>(),
|
659
812
|
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
660
|
-
: getter(getter),
|
661
|
-
setter(setter),
|
662
|
-
query(query),
|
663
|
-
deleter(deleter),
|
813
|
+
: getter(reinterpret_cast<void*>(getter)),
|
814
|
+
setter(reinterpret_cast<void*>(setter)),
|
815
|
+
query(reinterpret_cast<void*>(query)),
|
816
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
664
817
|
enumerator(enumerator),
|
665
818
|
definer(nullptr),
|
666
819
|
descriptor(nullptr),
|
667
820
|
data(data),
|
668
821
|
flags(flags) {}
|
669
822
|
|
823
|
+
NamedPropertyHandlerConfiguration(
|
824
|
+
NamedPropertyGetterCallback getter, //
|
825
|
+
NamedPropertySetterCallback setter, //
|
826
|
+
NamedPropertyDescriptorCallback descriptor, //
|
827
|
+
NamedPropertyDeleterCallback deleter, //
|
828
|
+
NamedPropertyEnumeratorCallback enumerator, //
|
829
|
+
NamedPropertyDefinerCallback definer, //
|
830
|
+
Local<Value> data = Local<Value>(),
|
831
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
832
|
+
: getter(reinterpret_cast<void*>(getter)),
|
833
|
+
setter(reinterpret_cast<void*>(setter)),
|
834
|
+
query(nullptr),
|
835
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
836
|
+
enumerator(enumerator),
|
837
|
+
definer(reinterpret_cast<void*>(definer)),
|
838
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
839
|
+
data(data),
|
840
|
+
flags(WithNewSignatureFlag(flags)) {}
|
841
|
+
|
842
|
+
// This variant will be deprecated soon.
|
670
843
|
NamedPropertyHandlerConfiguration(
|
671
844
|
GenericNamedPropertyGetterCallback getter,
|
672
845
|
GenericNamedPropertySetterCallback setter,
|
@@ -676,66 +849,136 @@ struct NamedPropertyHandlerConfiguration {
|
|
676
849
|
GenericNamedPropertyDefinerCallback definer,
|
677
850
|
Local<Value> data = Local<Value>(),
|
678
851
|
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
679
|
-
: getter(getter),
|
680
|
-
setter(setter),
|
852
|
+
: getter(reinterpret_cast<void*>(getter)),
|
853
|
+
setter(reinterpret_cast<void*>(setter)),
|
681
854
|
query(nullptr),
|
682
|
-
deleter(deleter),
|
855
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
683
856
|
enumerator(enumerator),
|
684
|
-
definer(definer),
|
685
|
-
descriptor(descriptor),
|
857
|
+
definer(reinterpret_cast<void*>(definer)),
|
858
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
686
859
|
data(data),
|
687
860
|
flags(flags) {}
|
688
861
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
862
|
+
void* getter; // [Generic]NamedPropertyGetterCallback
|
863
|
+
void* setter; // [Generic]NamedPropertySetterCallback
|
864
|
+
void* query; // [Generic]NamedPropertyQueryCallback
|
865
|
+
void* deleter; // [Generic]NamedPropertyDeleterCallback
|
866
|
+
NamedPropertyEnumeratorCallback enumerator;
|
867
|
+
void* definer; // [Generic]NamedPropertyDefinerCallback
|
868
|
+
void* descriptor; // [Generic]NamedPropertyDescriptorCallback
|
696
869
|
Local<Value> data;
|
697
870
|
PropertyHandlerFlags flags;
|
698
871
|
};
|
699
872
|
|
700
873
|
struct IndexedPropertyHandlerConfiguration {
|
874
|
+
private:
|
875
|
+
static constexpr PropertyHandlerFlags WithNewSignatureFlag(
|
876
|
+
PropertyHandlerFlags flags) {
|
877
|
+
return static_cast<PropertyHandlerFlags>(
|
878
|
+
static_cast<int>(flags) |
|
879
|
+
static_cast<int>(
|
880
|
+
PropertyHandlerFlags::kInternalNewCallbacksSignatures));
|
881
|
+
}
|
882
|
+
|
883
|
+
public:
|
701
884
|
IndexedPropertyHandlerConfiguration(
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
885
|
+
IndexedPropertyGetterCallbackV2 getter, //
|
886
|
+
IndexedPropertySetterCallbackV2 setter, //
|
887
|
+
IndexedPropertyQueryCallbackV2 query, //
|
888
|
+
IndexedPropertyDeleterCallbackV2 deleter, //
|
889
|
+
IndexedPropertyEnumeratorCallback enumerator, //
|
890
|
+
IndexedPropertyDefinerCallbackV2 definer, //
|
891
|
+
IndexedPropertyDescriptorCallbackV2 descriptor, //
|
708
892
|
Local<Value> data = Local<Value>(),
|
709
893
|
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
710
|
-
: getter(getter),
|
711
|
-
setter(setter),
|
712
|
-
query(query),
|
713
|
-
deleter(deleter),
|
894
|
+
: getter(reinterpret_cast<void*>(getter)),
|
895
|
+
setter(reinterpret_cast<void*>(setter)),
|
896
|
+
query(reinterpret_cast<void*>(query)),
|
897
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
714
898
|
enumerator(enumerator),
|
715
|
-
definer(definer),
|
716
|
-
descriptor(descriptor),
|
899
|
+
definer(reinterpret_cast<void*>(definer)),
|
900
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
717
901
|
data(data),
|
718
|
-
flags(flags) {}
|
902
|
+
flags(WithNewSignatureFlag(flags)) {}
|
719
903
|
|
904
|
+
// This variant will be deprecated soon.
|
720
905
|
IndexedPropertyHandlerConfiguration(
|
721
|
-
|
722
|
-
|
906
|
+
IndexedPropertyGetterCallback getter, //
|
907
|
+
IndexedPropertySetterCallback setter, //
|
908
|
+
IndexedPropertyQueryCallback query, //
|
909
|
+
IndexedPropertyDeleterCallback deleter, //
|
910
|
+
IndexedPropertyEnumeratorCallback enumerator, //
|
911
|
+
IndexedPropertyDefinerCallback definer, //
|
912
|
+
IndexedPropertyDescriptorCallback descriptor, //
|
913
|
+
Local<Value> data = Local<Value>(),
|
914
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
915
|
+
: getter(reinterpret_cast<void*>(getter)),
|
916
|
+
setter(reinterpret_cast<void*>(setter)),
|
917
|
+
query(reinterpret_cast<void*>(query)),
|
918
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
919
|
+
enumerator(enumerator),
|
920
|
+
definer(reinterpret_cast<void*>(definer)),
|
921
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
922
|
+
data(data),
|
923
|
+
flags(flags) {}
|
924
|
+
|
925
|
+
explicit IndexedPropertyHandlerConfiguration(
|
926
|
+
IndexedPropertyGetterCallbackV2 getter = nullptr,
|
927
|
+
IndexedPropertySetterCallbackV2 setter = nullptr,
|
928
|
+
IndexedPropertyQueryCallbackV2 query = nullptr,
|
929
|
+
IndexedPropertyDeleterCallbackV2 deleter = nullptr,
|
930
|
+
IndexedPropertyEnumeratorCallback enumerator = nullptr,
|
931
|
+
Local<Value> data = Local<Value>(),
|
932
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
933
|
+
: getter(reinterpret_cast<void*>(getter)),
|
934
|
+
setter(reinterpret_cast<void*>(setter)),
|
935
|
+
query(reinterpret_cast<void*>(query)),
|
936
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
937
|
+
enumerator(enumerator),
|
938
|
+
definer(nullptr),
|
939
|
+
descriptor(nullptr),
|
940
|
+
data(data),
|
941
|
+
flags(WithNewSignatureFlag(flags)) {}
|
942
|
+
|
943
|
+
// This variant will be deprecated soon.
|
944
|
+
explicit IndexedPropertyHandlerConfiguration(
|
945
|
+
IndexedPropertyGetterCallback getter,
|
723
946
|
IndexedPropertySetterCallback setter = nullptr,
|
724
947
|
IndexedPropertyQueryCallback query = nullptr,
|
725
948
|
IndexedPropertyDeleterCallback deleter = nullptr,
|
726
949
|
IndexedPropertyEnumeratorCallback enumerator = nullptr,
|
727
950
|
Local<Value> data = Local<Value>(),
|
728
951
|
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
729
|
-
: getter(getter),
|
730
|
-
setter(setter),
|
731
|
-
query(query),
|
732
|
-
deleter(deleter),
|
952
|
+
: getter(reinterpret_cast<void*>(getter)),
|
953
|
+
setter(reinterpret_cast<void*>(setter)),
|
954
|
+
query(reinterpret_cast<void*>(query)),
|
955
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
733
956
|
enumerator(enumerator),
|
734
957
|
definer(nullptr),
|
735
958
|
descriptor(nullptr),
|
736
959
|
data(data),
|
737
960
|
flags(flags) {}
|
738
961
|
|
962
|
+
IndexedPropertyHandlerConfiguration(
|
963
|
+
IndexedPropertyGetterCallbackV2 getter,
|
964
|
+
IndexedPropertySetterCallbackV2 setter,
|
965
|
+
IndexedPropertyDescriptorCallbackV2 descriptor,
|
966
|
+
IndexedPropertyDeleterCallbackV2 deleter,
|
967
|
+
IndexedPropertyEnumeratorCallback enumerator,
|
968
|
+
IndexedPropertyDefinerCallbackV2 definer,
|
969
|
+
Local<Value> data = Local<Value>(),
|
970
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
971
|
+
: getter(reinterpret_cast<void*>(getter)),
|
972
|
+
setter(reinterpret_cast<void*>(setter)),
|
973
|
+
query(nullptr),
|
974
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
975
|
+
enumerator(enumerator),
|
976
|
+
definer(reinterpret_cast<void*>(definer)),
|
977
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
978
|
+
data(data),
|
979
|
+
flags(WithNewSignatureFlag(flags)) {}
|
980
|
+
|
981
|
+
// This variant will be deprecated soon.
|
739
982
|
IndexedPropertyHandlerConfiguration(
|
740
983
|
IndexedPropertyGetterCallback getter,
|
741
984
|
IndexedPropertySetterCallback setter,
|
@@ -745,23 +988,23 @@ struct IndexedPropertyHandlerConfiguration {
|
|
745
988
|
IndexedPropertyDefinerCallback definer,
|
746
989
|
Local<Value> data = Local<Value>(),
|
747
990
|
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
748
|
-
: getter(getter),
|
749
|
-
setter(setter),
|
991
|
+
: getter(reinterpret_cast<void*>(getter)),
|
992
|
+
setter(reinterpret_cast<void*>(setter)),
|
750
993
|
query(nullptr),
|
751
|
-
deleter(deleter),
|
994
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
752
995
|
enumerator(enumerator),
|
753
|
-
definer(definer),
|
754
|
-
descriptor(descriptor),
|
996
|
+
definer(reinterpret_cast<void*>(definer)),
|
997
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
755
998
|
data(data),
|
756
999
|
flags(flags) {}
|
757
1000
|
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
1001
|
+
void* getter; // IndexedPropertyGetterCallback[V2]
|
1002
|
+
void* setter; // IndexedPropertySetterCallback[V2]
|
1003
|
+
void* query; // IndexedPropertyQueryCallback[V2]
|
1004
|
+
void* deleter; // IndexedPropertyDeleterCallback[V2]
|
762
1005
|
IndexedPropertyEnumeratorCallback enumerator;
|
763
|
-
|
764
|
-
|
1006
|
+
void* definer; // IndexedPropertyDefinerCallback[V2]
|
1007
|
+
void* descriptor; // IndexedPropertyDescriptorCallback[V2]
|
765
1008
|
Local<Value> data;
|
766
1009
|
PropertyHandlerFlags flags;
|
767
1010
|
};
|
@@ -779,7 +1022,11 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
779
1022
|
Isolate* isolate,
|
780
1023
|
Local<FunctionTemplate> constructor = Local<FunctionTemplate>());
|
781
1024
|
|
782
|
-
/**
|
1025
|
+
/**
|
1026
|
+
* Creates a new instance of this template.
|
1027
|
+
*
|
1028
|
+
* \param context The context in which the instance is created.
|
1029
|
+
*/
|
783
1030
|
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
|
784
1031
|
|
785
1032
|
/**
|
@@ -795,29 +1042,20 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
795
1042
|
* \param setter The callback to invoke when setting the property.
|
796
1043
|
* \param data A piece of data that will be passed to the getter and setter
|
797
1044
|
* callbacks whenever they are invoked.
|
798
|
-
* \param settings Access control settings for the accessor. This is a bit
|
799
|
-
* field consisting of one of more of
|
800
|
-
* DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
|
801
|
-
* The default is to not allow cross-context access.
|
802
|
-
* ALL_CAN_READ means that all cross-context reads are allowed.
|
803
|
-
* ALL_CAN_WRITE means that all cross-context writes are allowed.
|
804
|
-
* The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
|
805
|
-
* cross-context access.
|
806
1045
|
* \param attribute The attributes of the property for which an accessor
|
807
1046
|
* is added.
|
808
1047
|
*/
|
1048
|
+
V8_DEPRECATE_SOON("Use SetAccessor with Local<Name> instead")
|
809
1049
|
void SetAccessor(
|
810
1050
|
Local<String> name, AccessorGetterCallback getter,
|
811
1051
|
AccessorSetterCallback setter = nullptr,
|
812
|
-
Local<Value> data = Local<Value>(),
|
813
|
-
PropertyAttribute attribute = None,
|
1052
|
+
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
814
1053
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
815
1054
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
816
1055
|
void SetAccessor(
|
817
1056
|
Local<Name> name, AccessorNameGetterCallback getter,
|
818
1057
|
AccessorNameSetterCallback setter = nullptr,
|
819
|
-
Local<Value> data = Local<Value>(),
|
820
|
-
PropertyAttribute attribute = None,
|
1058
|
+
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
821
1059
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
822
1060
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
823
1061
|
|
@@ -850,7 +1088,7 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
850
1088
|
* \param data A piece of data that will be passed to the callbacks
|
851
1089
|
* whenever they are invoked.
|
852
1090
|
*/
|
853
|
-
|
1091
|
+
V8_DEPRECATE_SOON("Use SetHandler instead")
|
854
1092
|
void SetIndexedPropertyHandler(
|
855
1093
|
IndexedPropertyGetterCallback getter,
|
856
1094
|
IndexedPropertySetterCallback setter = nullptr,
|
@@ -955,12 +1193,46 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
955
1193
|
|
956
1194
|
private:
|
957
1195
|
ObjectTemplate();
|
958
|
-
|
959
|
-
Local<FunctionTemplate> constructor);
|
1196
|
+
|
960
1197
|
static void CheckCast(Data* that);
|
961
1198
|
friend class FunctionTemplate;
|
962
1199
|
};
|
963
1200
|
|
1201
|
+
/**
|
1202
|
+
* A template to create dictionary objects at runtime.
|
1203
|
+
*/
|
1204
|
+
class V8_EXPORT DictionaryTemplate final {
|
1205
|
+
public:
|
1206
|
+
/** Creates a new template. Also declares data properties that can be passed
|
1207
|
+
* on instantiation of the template. Properties can only be declared on
|
1208
|
+
* construction and are then immutable. The values are passed on creating the
|
1209
|
+
* object via `NewInstance()`.
|
1210
|
+
*
|
1211
|
+
* \param names the keys that can be passed on instantiation.
|
1212
|
+
*/
|
1213
|
+
static Local<DictionaryTemplate> New(
|
1214
|
+
Isolate* isolate, MemorySpan<const std::string_view> names);
|
1215
|
+
|
1216
|
+
/**
|
1217
|
+
* Creates a new instance of this template.
|
1218
|
+
*
|
1219
|
+
* \param context The context used to create the dictionary object.
|
1220
|
+
* \param property_values Values of properties that were declared using
|
1221
|
+
* `DeclareDataProperties()`. The span only passes values and expectes the
|
1222
|
+
* order to match the declaration. Non-existent properties are signaled via
|
1223
|
+
* empty `MaybeLocal`s.
|
1224
|
+
*/
|
1225
|
+
V8_WARN_UNUSED_RESULT Local<Object> NewInstance(
|
1226
|
+
Local<Context> context, MemorySpan<MaybeLocal<Value>> property_values);
|
1227
|
+
|
1228
|
+
V8_INLINE static DictionaryTemplate* Cast(Data* data);
|
1229
|
+
|
1230
|
+
private:
|
1231
|
+
static void CheckCast(Data* that);
|
1232
|
+
|
1233
|
+
DictionaryTemplate();
|
1234
|
+
};
|
1235
|
+
|
964
1236
|
/**
|
965
1237
|
* A Signature specifies which receiver is valid for a function.
|
966
1238
|
*
|
@@ -1006,6 +1278,13 @@ ObjectTemplate* ObjectTemplate::Cast(Data* data) {
|
|
1006
1278
|
return reinterpret_cast<ObjectTemplate*>(data);
|
1007
1279
|
}
|
1008
1280
|
|
1281
|
+
DictionaryTemplate* DictionaryTemplate::Cast(Data* data) {
|
1282
|
+
#ifdef V8_ENABLE_CHECKS
|
1283
|
+
CheckCast(data);
|
1284
|
+
#endif
|
1285
|
+
return reinterpret_cast<DictionaryTemplate*>(data);
|
1286
|
+
}
|
1287
|
+
|
1009
1288
|
Signature* Signature::Cast(Data* data) {
|
1010
1289
|
#ifdef V8_ENABLE_CHECKS
|
1011
1290
|
CheckCast(data);
|