@kungfu-tech/libnode-win32-x64 0.0.0-bootstrap.0 → 22.22.3-kf.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/node/include/acorn_version.h +6 -0
- package/dist/node/include/aliased_buffer-inl.h +244 -0
- package/dist/node/include/aliased_buffer.h +206 -0
- package/dist/node/include/aliased_struct-inl.h +54 -0
- package/dist/node/include/aliased_struct.h +63 -0
- package/dist/node/include/amaro_version.h +6 -0
- package/dist/node/include/async_context_frame.h +33 -0
- package/dist/node/include/async_wrap-inl.h +96 -0
- package/dist/node/include/async_wrap.h +243 -0
- package/dist/node/include/base_object-inl.h +335 -0
- package/dist/node/include/base_object.h +342 -0
- package/dist/node/include/base_object_types.h +74 -0
- package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
- package/dist/node/include/blob_serializer_deserializer.h +132 -0
- package/dist/node/include/callback_queue-inl.h +97 -0
- package/dist/node/include/callback_queue.h +79 -0
- package/dist/node/include/cares_wrap.h +447 -0
- package/dist/node/include/cjs_module_lexer_version.h +6 -0
- package/dist/node/include/cleanup_queue-inl.h +36 -0
- package/dist/node/include/cleanup_queue.h +79 -0
- package/dist/node/include/compile_cache.h +104 -0
- package/dist/node/include/connect_wrap.h +26 -0
- package/dist/node/include/connection_wrap.h +30 -0
- package/dist/node/include/cppgc/allocation.h +310 -0
- package/dist/node/include/cppgc/common.h +28 -0
- package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
- package/dist/node/include/cppgc/custom-space.h +97 -0
- package/dist/node/include/cppgc/default-platform.h +67 -0
- package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
- package/dist/node/include/cppgc/explicit-management.h +100 -0
- package/dist/node/include/cppgc/garbage-collected.h +106 -0
- package/dist/node/include/cppgc/heap-consistency.h +309 -0
- package/dist/node/include/cppgc/heap-handle.h +48 -0
- package/dist/node/include/cppgc/heap-state.h +82 -0
- package/dist/node/include/cppgc/heap-statistics.h +120 -0
- package/dist/node/include/cppgc/heap.h +202 -0
- package/dist/node/include/cppgc/internal/api-constants.h +87 -0
- package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
- package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
- package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
- package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
- package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
- package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
- package/dist/node/include/cppgc/internal/gc-info.h +148 -0
- package/dist/node/include/cppgc/internal/logging.h +50 -0
- package/dist/node/include/cppgc/internal/member-storage.h +256 -0
- package/dist/node/include/cppgc/internal/name-trait.h +137 -0
- package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
- package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
- package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
- package/dist/node/include/cppgc/liveness-broker.h +78 -0
- package/dist/node/include/cppgc/macros.h +35 -0
- package/dist/node/include/cppgc/member.h +629 -0
- package/dist/node/include/cppgc/name-provider.h +65 -0
- package/dist/node/include/cppgc/object-size-trait.h +58 -0
- package/dist/node/include/cppgc/persistent.h +377 -0
- package/dist/node/include/cppgc/platform.h +163 -0
- package/dist/node/include/cppgc/prefinalizer.h +75 -0
- package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
- package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
- package/dist/node/include/cppgc/source-location.h +16 -0
- package/dist/node/include/cppgc/testing.h +106 -0
- package/dist/node/include/cppgc/trace-trait.h +128 -0
- package/dist/node/include/cppgc/type-traits.h +271 -0
- package/dist/node/include/cppgc/visitor.h +504 -0
- package/dist/node/include/crypto/crypto_aes.h +88 -0
- package/dist/node/include/crypto/crypto_bio.h +193 -0
- package/dist/node/include/crypto/crypto_cipher.h +293 -0
- package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
- package/dist/node/include/crypto/crypto_clienthello.h +131 -0
- package/dist/node/include/crypto/crypto_common.h +64 -0
- package/dist/node/include/crypto/crypto_context.h +171 -0
- package/dist/node/include/crypto/crypto_dh.h +126 -0
- package/dist/node/include/crypto/crypto_dsa.h +52 -0
- package/dist/node/include/crypto/crypto_ec.h +164 -0
- package/dist/node/include/crypto/crypto_hash.h +91 -0
- package/dist/node/include/crypto/crypto_hkdf.h +61 -0
- package/dist/node/include/crypto/crypto_hmac.h +92 -0
- package/dist/node/include/crypto/crypto_keygen.h +299 -0
- package/dist/node/include/crypto/crypto_keys.h +392 -0
- package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
- package/dist/node/include/crypto/crypto_random.h +124 -0
- package/dist/node/include/crypto/crypto_rsa.h +136 -0
- package/dist/node/include/crypto/crypto_scrypt.h +85 -0
- package/dist/node/include/crypto/crypto_sig.h +165 -0
- package/dist/node/include/crypto/crypto_spkac.h +21 -0
- package/dist/node/include/crypto/crypto_timing.h +20 -0
- package/dist/node/include/crypto/crypto_tls.h +305 -0
- package/dist/node/include/crypto/crypto_util.h +725 -0
- package/dist/node/include/crypto/crypto_x509.h +140 -0
- package/dist/node/include/dataqueue/queue.h +306 -0
- package/dist/node/include/debug_utils-inl.h +278 -0
- package/dist/node/include/debug_utils.h +196 -0
- package/dist/node/include/diagnosticfilename-inl.h +33 -0
- package/dist/node/include/embedded_data.h +17 -0
- package/dist/node/include/encoding_binding.h +61 -0
- package/dist/node/include/env-inl.h +984 -0
- package/dist/node/include/env.h +1287 -0
- package/dist/node/include/env_properties.h +540 -0
- package/dist/node/include/handle_wrap.h +123 -0
- package/dist/node/include/histogram-inl.h +107 -0
- package/dist/node/include/histogram.h +279 -0
- package/dist/node/include/inspector/io_agent.h +30 -0
- package/dist/node/include/inspector/main_thread_interface.h +116 -0
- package/dist/node/include/inspector/network_agent.h +94 -0
- package/dist/node/include/inspector/network_inspector.h +45 -0
- package/dist/node/include/inspector/network_requests_buffer.h +195 -0
- package/dist/node/include/inspector/network_resource_manager.h +29 -0
- package/dist/node/include/inspector/node_json.h +24 -0
- package/dist/node/include/inspector/node_string.h +101 -0
- package/dist/node/include/inspector/protocol_helper.h +27 -0
- package/dist/node/include/inspector/runtime_agent.h +41 -0
- package/dist/node/include/inspector/target_agent.h +75 -0
- package/dist/node/include/inspector/tracing_agent.h +43 -0
- package/dist/node/include/inspector/worker_agent.h +40 -0
- package/dist/node/include/inspector/worker_inspector.h +124 -0
- package/dist/node/include/inspector_agent.h +165 -0
- package/dist/node/include/inspector_io.h +78 -0
- package/dist/node/include/inspector_profiler.h +149 -0
- package/dist/node/include/inspector_socket.h +60 -0
- package/dist/node/include/inspector_socket_server.h +110 -0
- package/dist/node/include/js_native_api.h +607 -0
- package/dist/node/include/js_native_api_types.h +226 -0
- package/dist/node/include/js_native_api_v8.h +485 -0
- package/dist/node/include/js_native_api_v8_internals.h +45 -0
- package/dist/node/include/js_stream.h +52 -0
- package/dist/node/include/json_utils.h +172 -0
- package/dist/node/include/large_pages/node_large_page.h +34 -0
- package/dist/node/include/libplatform/libplatform-export.h +29 -0
- package/dist/node/include/libplatform/libplatform.h +112 -0
- package/dist/node/include/libplatform/v8-tracing.h +333 -0
- package/dist/node/include/memory_tracker-inl.h +359 -0
- package/dist/node/include/memory_tracker.h +289 -0
- package/dist/node/include/module_wrap.h +216 -0
- package/dist/node/include/node.h +1593 -0
- package/dist/node/include/node_api.h +265 -0
- package/dist/node/include/node_api_internals.h +48 -0
- package/dist/node/include/node_api_types.h +56 -0
- package/dist/node/include/node_binding.h +161 -0
- package/dist/node/include/node_blob.h +159 -0
- package/dist/node/include/node_bob-inl.h +36 -0
- package/dist/node/include/node_bob.h +107 -0
- package/dist/node/include/node_buffer.h +92 -0
- package/dist/node/include/node_builtins.h +220 -0
- package/dist/node/include/node_config_file.h +46 -0
- package/dist/node/include/node_constants.h +82 -0
- package/dist/node/include/node_context_data.h +168 -0
- package/dist/node/include/node_contextify.h +204 -0
- package/dist/node/include/node_crypto.h +56 -0
- package/dist/node/include/node_debug.h +30 -0
- package/dist/node/include/node_dir.h +52 -0
- package/dist/node/include/node_dotenv.h +45 -0
- package/dist/node/include/node_errors.h +380 -0
- package/dist/node/include/node_exit_code.h +54 -0
- package/dist/node/include/node_external_reference.h +165 -0
- package/dist/node/include/node_file-inl.h +406 -0
- package/dist/node/include/node_file.h +537 -0
- package/dist/node/include/node_http2.h +1177 -0
- package/dist/node/include/node_http2_state.h +159 -0
- package/dist/node/include/node_http_common-inl.h +202 -0
- package/dist/node/include/node_http_common.h +535 -0
- package/dist/node/include/node_i18n.h +132 -0
- package/dist/node/include/node_internals.h +483 -0
- package/dist/node/include/node_main_instance.h +67 -0
- package/dist/node/include/node_mem-inl.h +113 -0
- package/dist/node/include/node_mem.h +45 -0
- package/dist/node/include/node_messaging.h +389 -0
- package/dist/node/include/node_metadata.h +164 -0
- package/dist/node/include/node_modules.h +91 -0
- package/dist/node/include/node_mutex.h +323 -0
- package/dist/node/include/node_object_wrap.h +132 -0
- package/dist/node/include/node_options-inl.h +490 -0
- package/dist/node/include/node_options.h +615 -0
- package/dist/node/include/node_perf.h +166 -0
- package/dist/node/include/node_perf_common.h +102 -0
- package/dist/node/include/node_platform.h +238 -0
- package/dist/node/include/node_process-inl.h +26 -0
- package/dist/node/include/node_process.h +112 -0
- package/dist/node/include/node_realm-inl.h +151 -0
- package/dist/node/include/node_realm.h +183 -0
- package/dist/node/include/node_report.h +43 -0
- package/dist/node/include/node_revert.h +82 -0
- package/dist/node/include/node_root_certs.h +3520 -0
- package/dist/node/include/node_sea.h +74 -0
- package/dist/node/include/node_shadow_realm.h +46 -0
- package/dist/node/include/node_snapshot_builder.h +57 -0
- package/dist/node/include/node_snapshotable.h +174 -0
- package/dist/node/include/node_sockaddr-inl.h +257 -0
- package/dist/node/include/node_sockaddr.h +394 -0
- package/dist/node/include/node_sqlite.h +270 -0
- package/dist/node/include/node_stat_watcher.h +73 -0
- package/dist/node/include/node_task_runner.h +92 -0
- package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
- package/dist/node/include/node_threadsafe_cow.h +105 -0
- package/dist/node/include/node_union_bytes.h +81 -0
- package/dist/node/include/node_url.h +96 -0
- package/dist/node/include/node_v8.h +77 -0
- package/dist/node/include/node_v8_platform-inl.h +185 -0
- package/dist/node/include/node_version.h +110 -0
- package/dist/node/include/node_wasi.h +184 -0
- package/dist/node/include/node_wasm_web_api.h +55 -0
- package/dist/node/include/node_watchdog.h +154 -0
- package/dist/node/include/node_webstorage.h +60 -0
- package/dist/node/include/node_worker.h +158 -0
- package/dist/node/include/path.h +33 -0
- package/dist/node/include/permission/addon_permission.h +31 -0
- package/dist/node/include/permission/child_process_permission.h +31 -0
- package/dist/node/include/permission/fs_permission.h +167 -0
- package/dist/node/include/permission/inspector_permission.h +31 -0
- package/dist/node/include/permission/permission.h +138 -0
- package/dist/node/include/permission/permission_base.h +65 -0
- package/dist/node/include/permission/wasi_permission.h +31 -0
- package/dist/node/include/permission/worker_permission.h +31 -0
- package/dist/node/include/pipe_wrap.h +80 -0
- package/dist/node/include/quic/application.h +159 -0
- package/dist/node/include/quic/bindingdata.h +272 -0
- package/dist/node/include/quic/cid.h +127 -0
- package/dist/node/include/quic/data.h +148 -0
- package/dist/node/include/quic/defs.h +245 -0
- package/dist/node/include/quic/endpoint.h +458 -0
- package/dist/node/include/quic/http3.h +15 -0
- package/dist/node/include/quic/logstream.h +81 -0
- package/dist/node/include/quic/packet.h +152 -0
- package/dist/node/include/quic/preferredaddress.h +72 -0
- package/dist/node/include/quic/session.h +443 -0
- package/dist/node/include/quic/sessionticket.h +108 -0
- package/dist/node/include/quic/streams.h +232 -0
- package/dist/node/include/quic/tlscontext.h +227 -0
- package/dist/node/include/quic/tokens.h +256 -0
- package/dist/node/include/quic/transportparams.h +165 -0
- package/dist/node/include/req_wrap-inl.h +171 -0
- package/dist/node/include/req_wrap.h +77 -0
- package/dist/node/include/spawn_sync.h +243 -0
- package/dist/node/include/stream_base-inl.h +173 -0
- package/dist/node/include/stream_base.h +478 -0
- package/dist/node/include/stream_pipe.h +76 -0
- package/dist/node/include/stream_wrap.h +132 -0
- package/dist/node/include/string_bytes.h +113 -0
- package/dist/node/include/string_decoder-inl.h +31 -0
- package/dist/node/include/string_decoder.h +49 -0
- package/dist/node/include/tcp_wrap.h +105 -0
- package/dist/node/include/threadpoolwork-inl.h +70 -0
- package/dist/node/include/timer_wrap-inl.h +32 -0
- package/dist/node/include/timer_wrap.h +85 -0
- package/dist/node/include/timers.h +70 -0
- package/dist/node/include/tracing/agent.h +195 -0
- package/dist/node/include/tracing/node_trace_buffer.h +83 -0
- package/dist/node/include/tracing/node_trace_writer.h +75 -0
- package/dist/node/include/tracing/trace_event.h +722 -0
- package/dist/node/include/tracing/trace_event_common.h +1109 -0
- package/dist/node/include/tracing/traced_value.h +129 -0
- package/dist/node/include/tty_wrap.h +65 -0
- package/dist/node/include/udp_wrap.h +230 -0
- package/dist/node/include/undici_version.h +6 -0
- package/dist/node/include/util-inl.h +700 -0
- package/dist/node/include/util.h +1021 -0
- package/dist/node/include/uv/aix.h +32 -0
- package/dist/node/include/uv/bsd.h +34 -0
- package/dist/node/include/uv/darwin.h +61 -0
- package/dist/node/include/uv/errno.h +483 -0
- package/dist/node/include/uv/linux.h +34 -0
- package/dist/node/include/uv/os390.h +33 -0
- package/dist/node/include/uv/posix.h +31 -0
- package/dist/node/include/uv/sunos.h +44 -0
- package/dist/node/include/uv/threadpool.h +37 -0
- package/dist/node/include/uv/tree.h +521 -0
- package/dist/node/include/uv/unix.h +512 -0
- package/dist/node/include/uv/version.h +43 -0
- package/dist/node/include/uv/win.h +698 -0
- package/dist/node/include/uv.h +1990 -0
- package/dist/node/include/v8-array-buffer.h +525 -0
- package/dist/node/include/v8-callbacks.h +462 -0
- package/dist/node/include/v8-container.h +183 -0
- package/dist/node/include/v8-context.h +485 -0
- package/dist/node/include/v8-cppgc.h +245 -0
- package/dist/node/include/v8-data.h +80 -0
- package/dist/node/include/v8-date.h +48 -0
- package/dist/node/include/v8-debug.h +168 -0
- package/dist/node/include/v8-embedder-heap.h +82 -0
- package/dist/node/include/v8-embedder-state-scope.h +52 -0
- package/dist/node/include/v8-exception.h +223 -0
- package/dist/node/include/v8-extension.h +62 -0
- package/dist/node/include/v8-external.h +37 -0
- package/dist/node/include/v8-fast-api-calls.h +984 -0
- package/dist/node/include/v8-forward.h +82 -0
- package/dist/node/include/v8-function-callback.h +607 -0
- package/dist/node/include/v8-function.h +140 -0
- package/dist/node/include/v8-handle-base.h +137 -0
- package/dist/node/include/v8-initialization.h +289 -0
- package/dist/node/include/v8-inspector-protocol.h +13 -0
- package/dist/node/include/v8-inspector.h +419 -0
- package/dist/node/include/v8-internal.h +1397 -0
- package/dist/node/include/v8-isolate.h +1767 -0
- package/dist/node/include/v8-json.h +47 -0
- package/dist/node/include/v8-local-handle.h +758 -0
- package/dist/node/include/v8-locker.h +138 -0
- package/dist/node/include/v8-maybe.h +160 -0
- package/dist/node/include/v8-memory-span.h +198 -0
- package/dist/node/include/v8-message.h +233 -0
- package/dist/node/include/v8-metrics.h +264 -0
- package/dist/node/include/v8-microtask-queue.h +157 -0
- package/dist/node/include/v8-microtask.h +28 -0
- package/dist/node/include/v8-object.h +824 -0
- package/dist/node/include/v8-persistent-handle.h +582 -0
- package/dist/node/include/v8-platform.h +1358 -0
- package/dist/node/include/v8-primitive-object.h +118 -0
- package/dist/node/include/v8-primitive.h +877 -0
- package/dist/node/include/v8-profiler.h +1302 -0
- package/dist/node/include/v8-promise.h +174 -0
- package/dist/node/include/v8-proxy.h +50 -0
- package/dist/node/include/v8-regexp.h +106 -0
- package/dist/node/include/v8-script.h +904 -0
- package/dist/node/include/v8-snapshot.h +266 -0
- package/dist/node/include/v8-source-location.h +92 -0
- package/dist/node/include/v8-statistics.h +238 -0
- package/dist/node/include/v8-template.h +1297 -0
- package/dist/node/include/v8-traced-handle.h +432 -0
- package/dist/node/include/v8-typed-array.h +390 -0
- package/dist/node/include/v8-unwinder-state.h +31 -0
- package/dist/node/include/v8-unwinder.h +132 -0
- package/dist/node/include/v8-util.h +665 -0
- package/dist/node/include/v8-value-serializer-version.h +24 -0
- package/dist/node/include/v8-value-serializer.h +316 -0
- package/dist/node/include/v8-value.h +655 -0
- package/dist/node/include/v8-version-string.h +38 -0
- package/dist/node/include/v8-version.h +20 -0
- package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
- package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
- package/dist/node/include/v8-wasm.h +201 -0
- package/dist/node/include/v8-weak-callback-info.h +80 -0
- package/dist/node/include/v8.h +88 -0
- package/dist/node/include/v8config.h +981 -0
- package/dist/node/include/zlib_version.h +6 -0
- package/dist/node/libnode.dll +0 -0
- package/dist/node/libnode.lib +0 -0
- package/dist/node/libnodebuildinfo.json +10 -0
- package/dist/node/link_node.lib +0 -0
- package/dist/node/link_node.node +0 -0
- package/index.js +5 -0
- package/libnode.release.json +8 -0
- package/package.json +29 -1
|
@@ -0,0 +1,1297 @@
|
|
|
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-function-callback.h" // NOLINT(build/include_directory)
|
|
13
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
14
|
+
#include "v8-memory-span.h" // NOLINT(build/include_directory)
|
|
15
|
+
#include "v8-object.h" // NOLINT(build/include_directory)
|
|
16
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
17
|
+
|
|
18
|
+
namespace v8 {
|
|
19
|
+
|
|
20
|
+
class CFunction;
|
|
21
|
+
class FunctionTemplate;
|
|
22
|
+
class ObjectTemplate;
|
|
23
|
+
class Signature;
|
|
24
|
+
|
|
25
|
+
// --- Templates ---
|
|
26
|
+
|
|
27
|
+
#define V8_INTRINSICS_LIST(F) \
|
|
28
|
+
F(ArrayProto_entries, array_entries_iterator) \
|
|
29
|
+
F(ArrayProto_forEach, array_for_each_iterator) \
|
|
30
|
+
F(ArrayProto_keys, array_keys_iterator) \
|
|
31
|
+
F(ArrayProto_values, array_values_iterator) \
|
|
32
|
+
F(ArrayPrototype, initial_array_prototype) \
|
|
33
|
+
F(AsyncIteratorPrototype, initial_async_iterator_prototype) \
|
|
34
|
+
F(ErrorPrototype, initial_error_prototype) \
|
|
35
|
+
F(IteratorPrototype, initial_iterator_prototype) \
|
|
36
|
+
F(MapIteratorPrototype, initial_map_iterator_prototype) \
|
|
37
|
+
F(ObjProto_valueOf, object_value_of_function) \
|
|
38
|
+
F(SetIteratorPrototype, initial_set_iterator_prototype)
|
|
39
|
+
|
|
40
|
+
enum Intrinsic {
|
|
41
|
+
#define V8_DECL_INTRINSIC(name, iname) k##name,
|
|
42
|
+
V8_INTRINSICS_LIST(V8_DECL_INTRINSIC)
|
|
43
|
+
#undef V8_DECL_INTRINSIC
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The superclass of object and function templates.
|
|
48
|
+
*/
|
|
49
|
+
class V8_EXPORT Template : public Data {
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Adds a property to each instance created by this template.
|
|
53
|
+
*
|
|
54
|
+
* The property must be defined either as a primitive value, or a template.
|
|
55
|
+
*/
|
|
56
|
+
void Set(Local<Name> name, Local<Data> value,
|
|
57
|
+
PropertyAttribute attributes = None);
|
|
58
|
+
void SetPrivate(Local<Private> name, Local<Data> value,
|
|
59
|
+
PropertyAttribute attributes = None);
|
|
60
|
+
V8_INLINE void Set(Isolate* isolate, const char* name, Local<Data> value,
|
|
61
|
+
PropertyAttribute attributes = None);
|
|
62
|
+
|
|
63
|
+
void SetAccessorProperty(
|
|
64
|
+
Local<Name> name,
|
|
65
|
+
Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
|
|
66
|
+
Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
|
|
67
|
+
PropertyAttribute attribute = None);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Whenever the property with the given name is accessed on objects
|
|
71
|
+
* created from this Template the getter and setter callbacks
|
|
72
|
+
* are called instead of getting and setting the property directly
|
|
73
|
+
* on the JavaScript object.
|
|
74
|
+
*
|
|
75
|
+
* \param name The name of the property for which an accessor is added.
|
|
76
|
+
* \param getter The callback to invoke when getting the property.
|
|
77
|
+
* \param setter The callback to invoke when setting the property.
|
|
78
|
+
* \param data A piece of data that will be passed to the getter and setter
|
|
79
|
+
* callbacks whenever they are invoked.
|
|
80
|
+
* \param attribute The attributes of the property for which an accessor
|
|
81
|
+
* is added.
|
|
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")
|
|
98
|
+
void SetNativeDataProperty(
|
|
99
|
+
Local<String> name, AccessorGetterCallback getter,
|
|
100
|
+
AccessorSetterCallback setter = nullptr,
|
|
101
|
+
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
|
102
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
|
103
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
|
104
|
+
void SetNativeDataProperty(
|
|
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
|
+
*/
|
|
115
|
+
void SetLazyDataProperty(
|
|
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
|
+
*/
|
|
125
|
+
void SetIntrinsicDataProperty(Local<Name> name, Intrinsic intrinsic,
|
|
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
|
+
*/
|
|
139
|
+
enum 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) 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.
|
|
151
|
+
*
|
|
152
|
+
* \param property The name of the property for which the request was
|
|
153
|
+
* intercepted.
|
|
154
|
+
* \param info Information about the intercepted request, such as
|
|
155
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
|
156
|
+
* See `PropertyCallbackInfo`.
|
|
157
|
+
*
|
|
158
|
+
* \code
|
|
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;
|
|
164
|
+
* }
|
|
165
|
+
*
|
|
166
|
+
* v8::Local<v8::FunctionTemplate> templ =
|
|
167
|
+
* v8::FunctionTemplate::New(isolate);
|
|
168
|
+
* templ->InstanceTemplate()->SetHandler(
|
|
169
|
+
* v8::NamedPropertyHandlerConfiguration(GetterCallback));
|
|
170
|
+
* LocalContext env;
|
|
171
|
+
* env->Global()
|
|
172
|
+
* ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
|
|
173
|
+
* .ToLocalChecked()
|
|
174
|
+
* ->NewInstance(env.local())
|
|
175
|
+
* .ToLocalChecked())
|
|
176
|
+
* .FromJust();
|
|
177
|
+
* v8::Local<v8::Value> result = CompileRun("obj.a = 17; obj.a");
|
|
178
|
+
* CHECK(v8_num(42)->Equals(env.local(), result).FromJust());
|
|
179
|
+
* \endcode
|
|
180
|
+
*
|
|
181
|
+
* See also `ObjectTemplate::SetHandler`.
|
|
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.
|
|
190
|
+
using GenericNamedPropertyGetterCallback =
|
|
191
|
+
void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Interceptor for set requests on an object.
|
|
195
|
+
*
|
|
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.
|
|
200
|
+
*
|
|
201
|
+
* \param property The name of the property for which the request was
|
|
202
|
+
* intercepted.
|
|
203
|
+
* \param value The value which the property will have if the request
|
|
204
|
+
* is not intercepted.
|
|
205
|
+
* \param info Information about the intercepted request, such as
|
|
206
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
|
207
|
+
* See `PropertyCallbackInfo`.
|
|
208
|
+
*
|
|
209
|
+
* See also `ObjectTemplate::SetHandler.`
|
|
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.
|
|
222
|
+
using GenericNamedPropertySetterCallback =
|
|
223
|
+
void (*)(Local<Name> property, Local<Value> value,
|
|
224
|
+
const PropertyCallbackInfo<Value>& info);
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Intercepts all requests that query the attributes of the
|
|
228
|
+
* property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and
|
|
229
|
+
* defineProperty().
|
|
230
|
+
*
|
|
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.
|
|
238
|
+
*
|
|
239
|
+
* \param property The name of the property for which the request was
|
|
240
|
+
* intercepted.
|
|
241
|
+
* \param info Information about the intercepted request, such as
|
|
242
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
|
243
|
+
* See `PropertyCallbackInfo`.
|
|
244
|
+
*
|
|
245
|
+
* \note Some functions query the property attributes internally, even though
|
|
246
|
+
* they do not return the attributes. For example, `hasOwnProperty()` can
|
|
247
|
+
* trigger this interceptor depending on the state of the object.
|
|
248
|
+
*
|
|
249
|
+
* See also `ObjectTemplate::SetHandler.`
|
|
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.
|
|
259
|
+
using GenericNamedPropertyQueryCallback =
|
|
260
|
+
void (*)(Local<Name> property, const PropertyCallbackInfo<Integer>& info);
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Interceptor for delete requests on an object.
|
|
264
|
+
*
|
|
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.
|
|
272
|
+
*
|
|
273
|
+
* \param property The name of the property for which the request was
|
|
274
|
+
* intercepted.
|
|
275
|
+
* \param info Information about the intercepted request, such as
|
|
276
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
|
277
|
+
* See `PropertyCallbackInfo`.
|
|
278
|
+
*
|
|
279
|
+
* \note If you need to mimic the behavior of `delete`, i.e., throw in strict
|
|
280
|
+
* mode instead of returning false, use `info.ShouldThrowOnError()` to determine
|
|
281
|
+
* if you are in strict mode.
|
|
282
|
+
*
|
|
283
|
+
* See also `ObjectTemplate::SetHandler.`
|
|
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.
|
|
295
|
+
using GenericNamedPropertyDeleterCallback =
|
|
296
|
+
void (*)(Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Returns an array containing the names of the properties the named
|
|
300
|
+
* property getter intercepts.
|
|
301
|
+
*
|
|
302
|
+
* Note: The values in the array must be of type v8::Name.
|
|
303
|
+
*/
|
|
304
|
+
using NamedPropertyEnumeratorCallback =
|
|
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;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Interceptor for defineProperty requests on an object.
|
|
312
|
+
*
|
|
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.
|
|
317
|
+
*
|
|
318
|
+
* \param property The name of the property for which the request was
|
|
319
|
+
* intercepted.
|
|
320
|
+
* \param desc The property descriptor which is used to define the
|
|
321
|
+
* property if the request is not intercepted.
|
|
322
|
+
* \param info Information about the intercepted request, such as
|
|
323
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
|
324
|
+
* See `PropertyCallbackInfo`.
|
|
325
|
+
*
|
|
326
|
+
* See also `ObjectTemplate::SetHandler`.
|
|
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.
|
|
339
|
+
using GenericNamedPropertyDefinerCallback =
|
|
340
|
+
void (*)(Local<Name> property, const PropertyDescriptor& desc,
|
|
341
|
+
const PropertyCallbackInfo<Value>& info);
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Interceptor for getOwnPropertyDescriptor requests on an object.
|
|
345
|
+
*
|
|
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.
|
|
354
|
+
*
|
|
355
|
+
* \param property The name of the property for which the request was
|
|
356
|
+
* intercepted.
|
|
357
|
+
* \info Information about the intercepted request, such as
|
|
358
|
+
* isolate, receiver, return value, or whether running in `'use strict'` mode.
|
|
359
|
+
* See `PropertyCallbackInfo`.
|
|
360
|
+
*
|
|
361
|
+
* \note If GetOwnPropertyDescriptor is intercepted, it will
|
|
362
|
+
* always return true, i.e., indicate that the property was found.
|
|
363
|
+
*
|
|
364
|
+
* See also `ObjectTemplate::SetHandler`.
|
|
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`.
|
|
374
|
+
using GenericNamedPropertyDescriptorCallback =
|
|
375
|
+
void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
|
|
376
|
+
|
|
377
|
+
// TODO(ishell): Rename IndexedPropertyXxxCallbackV2 back to
|
|
378
|
+
// IndexedPropertyXxxCallback once the old IndexedPropertyXxxCallback is
|
|
379
|
+
// removed.
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* See `v8::GenericNamedPropertyGetterCallback`.
|
|
383
|
+
*/
|
|
384
|
+
using IndexedPropertyGetterCallbackV2 =
|
|
385
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
|
386
|
+
// This variant will be deprecated soon.
|
|
387
|
+
using IndexedPropertyGetterCallback =
|
|
388
|
+
void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* See `v8::GenericNamedPropertySetterCallback`.
|
|
392
|
+
*/
|
|
393
|
+
using IndexedPropertySetterCallbackV2 = Intercepted (*)(
|
|
394
|
+
uint32_t index, Local<Value> value, const PropertyCallbackInfo<void>& info);
|
|
395
|
+
// This variant will be deprecated soon.
|
|
396
|
+
using IndexedPropertySetterCallback =
|
|
397
|
+
void (*)(uint32_t index, Local<Value> value,
|
|
398
|
+
const PropertyCallbackInfo<Value>& info);
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* See `v8::GenericNamedPropertyQueryCallback`.
|
|
402
|
+
*/
|
|
403
|
+
using IndexedPropertyQueryCallbackV2 =
|
|
404
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
|
|
405
|
+
// This variant will be deprecated soon.
|
|
406
|
+
using IndexedPropertyQueryCallback =
|
|
407
|
+
void (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* See `v8::GenericNamedPropertyDeleterCallback`.
|
|
411
|
+
*/
|
|
412
|
+
using IndexedPropertyDeleterCallbackV2 =
|
|
413
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
|
|
414
|
+
// This variant will be deprecated soon.
|
|
415
|
+
using IndexedPropertyDeleterCallback =
|
|
416
|
+
void (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Returns an array containing the indices of the properties the indexed
|
|
420
|
+
* property getter intercepts.
|
|
421
|
+
*
|
|
422
|
+
* Note: The values in the array must be uint32_t.
|
|
423
|
+
*/
|
|
424
|
+
using IndexedPropertyEnumeratorCallback =
|
|
425
|
+
void (*)(const PropertyCallbackInfo<Array>& info);
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* See `v8::GenericNamedPropertyDefinerCallback`.
|
|
429
|
+
*/
|
|
430
|
+
using IndexedPropertyDefinerCallbackV2 =
|
|
431
|
+
Intercepted (*)(uint32_t index, const PropertyDescriptor& desc,
|
|
432
|
+
const PropertyCallbackInfo<void>& info);
|
|
433
|
+
// This variant will be deprecated soon.
|
|
434
|
+
using IndexedPropertyDefinerCallback =
|
|
435
|
+
void (*)(uint32_t index, const PropertyDescriptor& desc,
|
|
436
|
+
const PropertyCallbackInfo<Value>& info);
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* See `v8::GenericNamedPropertyDescriptorCallback`.
|
|
440
|
+
*/
|
|
441
|
+
using IndexedPropertyDescriptorCallbackV2 =
|
|
442
|
+
Intercepted (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
|
443
|
+
// This variant will be deprecated soon.
|
|
444
|
+
using IndexedPropertyDescriptorCallback =
|
|
445
|
+
void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Returns true if the given context should be allowed to access the given
|
|
449
|
+
* object.
|
|
450
|
+
*/
|
|
451
|
+
using AccessCheckCallback = bool (*)(Local<Context> accessing_context,
|
|
452
|
+
Local<Object> accessed_object,
|
|
453
|
+
Local<Value> data);
|
|
454
|
+
|
|
455
|
+
enum class ConstructorBehavior { kThrow, kAllow };
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* A FunctionTemplate is used to create functions at runtime. There
|
|
459
|
+
* can only be one function created from a FunctionTemplate in a
|
|
460
|
+
* context. The lifetime of the created function is equal to the
|
|
461
|
+
* lifetime of the context. So in case the embedder needs to create
|
|
462
|
+
* temporary functions that can be collected using Scripts is
|
|
463
|
+
* preferred.
|
|
464
|
+
*
|
|
465
|
+
* Any modification of a FunctionTemplate after first instantiation will trigger
|
|
466
|
+
* a crash.
|
|
467
|
+
*
|
|
468
|
+
* A FunctionTemplate can have properties, these properties are added to the
|
|
469
|
+
* function object when it is created.
|
|
470
|
+
*
|
|
471
|
+
* A FunctionTemplate has a corresponding instance template which is
|
|
472
|
+
* used to create object instances when the function is used as a
|
|
473
|
+
* constructor. Properties added to the instance template are added to
|
|
474
|
+
* each object instance.
|
|
475
|
+
*
|
|
476
|
+
* A FunctionTemplate can have a prototype template. The prototype template
|
|
477
|
+
* is used to create the prototype object of the function.
|
|
478
|
+
*
|
|
479
|
+
* The following example shows how to use a FunctionTemplate:
|
|
480
|
+
*
|
|
481
|
+
* \code
|
|
482
|
+
* v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
|
|
483
|
+
* t->Set(isolate, "func_property", v8::Number::New(isolate, 1));
|
|
484
|
+
*
|
|
485
|
+
* v8::Local<v8::Template> proto_t = t->PrototypeTemplate();
|
|
486
|
+
* proto_t->Set(isolate,
|
|
487
|
+
* "proto_method",
|
|
488
|
+
* v8::FunctionTemplate::New(isolate, InvokeCallback));
|
|
489
|
+
* proto_t->Set(isolate, "proto_const", v8::Number::New(isolate, 2));
|
|
490
|
+
*
|
|
491
|
+
* v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate();
|
|
492
|
+
* instance_t->SetAccessor(
|
|
493
|
+
String::NewFromUtf8Literal(isolate, "instance_accessor"),
|
|
494
|
+
* InstanceAccessorCallback);
|
|
495
|
+
* instance_t->SetHandler(
|
|
496
|
+
* NamedPropertyHandlerConfiguration(PropertyHandlerCallback));
|
|
497
|
+
* instance_t->Set(String::NewFromUtf8Literal(isolate, "instance_property"),
|
|
498
|
+
* Number::New(isolate, 3));
|
|
499
|
+
*
|
|
500
|
+
* v8::Local<v8::Function> function = t->GetFunction();
|
|
501
|
+
* v8::Local<v8::Object> instance = function->NewInstance();
|
|
502
|
+
* \endcode
|
|
503
|
+
*
|
|
504
|
+
* Let's use "function" as the JS variable name of the function object
|
|
505
|
+
* and "instance" for the instance object created above. The function
|
|
506
|
+
* and the instance will have the following properties:
|
|
507
|
+
*
|
|
508
|
+
* \code
|
|
509
|
+
* func_property in function == true;
|
|
510
|
+
* function.func_property == 1;
|
|
511
|
+
*
|
|
512
|
+
* function.prototype.proto_method() invokes 'InvokeCallback'
|
|
513
|
+
* function.prototype.proto_const == 2;
|
|
514
|
+
*
|
|
515
|
+
* instance instanceof function == true;
|
|
516
|
+
* instance.instance_accessor calls 'InstanceAccessorCallback'
|
|
517
|
+
* instance.instance_property == 3;
|
|
518
|
+
* \endcode
|
|
519
|
+
*
|
|
520
|
+
* A FunctionTemplate can inherit from another one by calling the
|
|
521
|
+
* FunctionTemplate::Inherit method. The following graph illustrates
|
|
522
|
+
* the semantics of inheritance:
|
|
523
|
+
*
|
|
524
|
+
* \code
|
|
525
|
+
* FunctionTemplate Parent -> Parent() . prototype -> { }
|
|
526
|
+
* ^ ^
|
|
527
|
+
* | Inherit(Parent) | .__proto__
|
|
528
|
+
* | |
|
|
529
|
+
* FunctionTemplate Child -> Child() . prototype -> { }
|
|
530
|
+
* \endcode
|
|
531
|
+
*
|
|
532
|
+
* A FunctionTemplate 'Child' inherits from 'Parent', the prototype
|
|
533
|
+
* object of the Child() function has __proto__ pointing to the
|
|
534
|
+
* Parent() function's prototype object. An instance of the Child
|
|
535
|
+
* function has all properties on Parent's instance templates.
|
|
536
|
+
*
|
|
537
|
+
* Let Parent be the FunctionTemplate initialized in the previous
|
|
538
|
+
* section and create a Child FunctionTemplate by:
|
|
539
|
+
*
|
|
540
|
+
* \code
|
|
541
|
+
* Local<FunctionTemplate> parent = t;
|
|
542
|
+
* Local<FunctionTemplate> child = FunctionTemplate::New();
|
|
543
|
+
* child->Inherit(parent);
|
|
544
|
+
*
|
|
545
|
+
* Local<Function> child_function = child->GetFunction();
|
|
546
|
+
* Local<Object> child_instance = child_function->NewInstance();
|
|
547
|
+
* \endcode
|
|
548
|
+
*
|
|
549
|
+
* The Child function and Child instance will have the following
|
|
550
|
+
* properties:
|
|
551
|
+
*
|
|
552
|
+
* \code
|
|
553
|
+
* child_func.prototype.__proto__ == function.prototype;
|
|
554
|
+
* child_instance.instance_accessor calls 'InstanceAccessorCallback'
|
|
555
|
+
* child_instance.instance_property == 3;
|
|
556
|
+
* \endcode
|
|
557
|
+
*
|
|
558
|
+
* The additional 'c_function' parameter refers to a fast API call, which
|
|
559
|
+
* must not trigger GC or JavaScript execution, or call into V8 in other
|
|
560
|
+
* ways. For more information how to define them, see
|
|
561
|
+
* include/v8-fast-api-calls.h. Please note that this feature is still
|
|
562
|
+
* experimental.
|
|
563
|
+
*/
|
|
564
|
+
class V8_EXPORT FunctionTemplate : public Template {
|
|
565
|
+
public:
|
|
566
|
+
/** Creates a function template.*/
|
|
567
|
+
static Local<FunctionTemplate> New(
|
|
568
|
+
Isolate* isolate, FunctionCallback callback = nullptr,
|
|
569
|
+
Local<Value> data = Local<Value>(),
|
|
570
|
+
Local<Signature> signature = Local<Signature>(), int length = 0,
|
|
571
|
+
ConstructorBehavior behavior = ConstructorBehavior::kAllow,
|
|
572
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
|
|
573
|
+
const CFunction* c_function = nullptr, uint16_t instance_type = 0,
|
|
574
|
+
uint16_t allowed_receiver_instance_type_range_start = 0,
|
|
575
|
+
uint16_t allowed_receiver_instance_type_range_end = 0);
|
|
576
|
+
|
|
577
|
+
/** Creates a function template for multiple overloaded fast API calls.*/
|
|
578
|
+
static Local<FunctionTemplate> NewWithCFunctionOverloads(
|
|
579
|
+
Isolate* isolate, FunctionCallback callback = nullptr,
|
|
580
|
+
Local<Value> data = Local<Value>(),
|
|
581
|
+
Local<Signature> signature = Local<Signature>(), int length = 0,
|
|
582
|
+
ConstructorBehavior behavior = ConstructorBehavior::kAllow,
|
|
583
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
|
|
584
|
+
const MemorySpan<const CFunction>& c_function_overloads = {});
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Creates a function template backed/cached by a private property.
|
|
588
|
+
*/
|
|
589
|
+
static Local<FunctionTemplate> NewWithCache(
|
|
590
|
+
Isolate* isolate, FunctionCallback callback,
|
|
591
|
+
Local<Private> cache_property, Local<Value> data = Local<Value>(),
|
|
592
|
+
Local<Signature> signature = Local<Signature>(), int length = 0,
|
|
593
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
|
|
594
|
+
|
|
595
|
+
/** Returns the unique function instance in the current execution context.*/
|
|
596
|
+
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
|
|
597
|
+
Local<Context> context);
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Similar to Context::NewRemoteContext, this creates an instance that
|
|
601
|
+
* isn't backed by an actual object.
|
|
602
|
+
*
|
|
603
|
+
* The InstanceTemplate of this FunctionTemplate must have access checks with
|
|
604
|
+
* handlers installed.
|
|
605
|
+
*/
|
|
606
|
+
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewRemoteInstance();
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Set the call-handler callback for a FunctionTemplate. This
|
|
610
|
+
* callback is called whenever the function created from this
|
|
611
|
+
* FunctionTemplate is called. The 'c_function' represents a fast
|
|
612
|
+
* API call, see the comment above the class declaration.
|
|
613
|
+
*/
|
|
614
|
+
void SetCallHandler(
|
|
615
|
+
FunctionCallback callback, Local<Value> data = Local<Value>(),
|
|
616
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
|
|
617
|
+
const MemorySpan<const CFunction>& c_function_overloads = {});
|
|
618
|
+
|
|
619
|
+
/** Set the predefined length property for the FunctionTemplate. */
|
|
620
|
+
void SetLength(int length);
|
|
621
|
+
|
|
622
|
+
/** Get the InstanceTemplate. */
|
|
623
|
+
Local<ObjectTemplate> InstanceTemplate();
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Causes the function template to inherit from a parent function template.
|
|
627
|
+
* This means the function's prototype.__proto__ is set to the parent
|
|
628
|
+
* function's prototype.
|
|
629
|
+
**/
|
|
630
|
+
void Inherit(Local<FunctionTemplate> parent);
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* A PrototypeTemplate is the template used to create the prototype object
|
|
634
|
+
* of the function created by this template.
|
|
635
|
+
*/
|
|
636
|
+
Local<ObjectTemplate> PrototypeTemplate();
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* A PrototypeProviderTemplate is another function template whose prototype
|
|
640
|
+
* property is used for this template. This is mutually exclusive with setting
|
|
641
|
+
* a prototype template indirectly by calling PrototypeTemplate() or using
|
|
642
|
+
* Inherit().
|
|
643
|
+
**/
|
|
644
|
+
void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Set the class name of the FunctionTemplate. This is used for
|
|
648
|
+
* printing objects created with the function created from the
|
|
649
|
+
* FunctionTemplate as its constructor.
|
|
650
|
+
*/
|
|
651
|
+
void SetClassName(Local<String> name);
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* When set to true, no access check will be performed on the receiver of a
|
|
655
|
+
* function call. Currently defaults to true, but this is subject to change.
|
|
656
|
+
*/
|
|
657
|
+
void SetAcceptAnyReceiver(bool value);
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Sets the ReadOnly flag in the attributes of the 'prototype' property
|
|
661
|
+
* of functions created from this FunctionTemplate to true.
|
|
662
|
+
*/
|
|
663
|
+
void ReadOnlyPrototype();
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Removes the prototype property from functions created from this
|
|
667
|
+
* FunctionTemplate.
|
|
668
|
+
*/
|
|
669
|
+
void RemovePrototype();
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Returns true if the given object is an instance of this function
|
|
673
|
+
* template.
|
|
674
|
+
*/
|
|
675
|
+
bool HasInstance(Local<Value> object);
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Returns true if the given value is an API object that was constructed by an
|
|
679
|
+
* instance of this function template (without checking for inheriting
|
|
680
|
+
* function templates).
|
|
681
|
+
*
|
|
682
|
+
* This is an experimental feature and may still change significantly.
|
|
683
|
+
*/
|
|
684
|
+
bool IsLeafTemplateForApiObject(v8::Local<v8::Value> value) const;
|
|
685
|
+
|
|
686
|
+
V8_INLINE static FunctionTemplate* Cast(Data* data);
|
|
687
|
+
|
|
688
|
+
private:
|
|
689
|
+
FunctionTemplate();
|
|
690
|
+
|
|
691
|
+
static void CheckCast(Data* that);
|
|
692
|
+
friend class Context;
|
|
693
|
+
friend class ObjectTemplate;
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Configuration flags for v8::NamedPropertyHandlerConfiguration or
|
|
698
|
+
* v8::IndexedPropertyHandlerConfiguration.
|
|
699
|
+
*/
|
|
700
|
+
enum class PropertyHandlerFlags {
|
|
701
|
+
/**
|
|
702
|
+
* None.
|
|
703
|
+
*/
|
|
704
|
+
kNone = 0,
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Will not call into interceptor for properties on the receiver or prototype
|
|
708
|
+
* chain, i.e., only call into interceptor for properties that do not exist.
|
|
709
|
+
* Currently only valid for named interceptors.
|
|
710
|
+
*/
|
|
711
|
+
kNonMasking = 1,
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Will not call into interceptor for symbol lookup. Only meaningful for
|
|
715
|
+
* named interceptors.
|
|
716
|
+
*/
|
|
717
|
+
kOnlyInterceptStrings = 1 << 1,
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* The getter, query, enumerator callbacks do not produce side effects.
|
|
721
|
+
*/
|
|
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,
|
|
732
|
+
};
|
|
733
|
+
|
|
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.
|
|
766
|
+
NamedPropertyHandlerConfiguration(
|
|
767
|
+
GenericNamedPropertyGetterCallback getter,
|
|
768
|
+
GenericNamedPropertySetterCallback setter,
|
|
769
|
+
GenericNamedPropertyQueryCallback query,
|
|
770
|
+
GenericNamedPropertyDeleterCallback deleter,
|
|
771
|
+
GenericNamedPropertyEnumeratorCallback enumerator,
|
|
772
|
+
GenericNamedPropertyDefinerCallback definer,
|
|
773
|
+
GenericNamedPropertyDescriptorCallback descriptor,
|
|
774
|
+
Local<Value> data = Local<Value>(),
|
|
775
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
|
776
|
+
: getter(reinterpret_cast<void*>(getter)),
|
|
777
|
+
setter(reinterpret_cast<void*>(setter)),
|
|
778
|
+
query(reinterpret_cast<void*>(query)),
|
|
779
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
|
780
|
+
enumerator(enumerator),
|
|
781
|
+
definer(reinterpret_cast<void*>(definer)),
|
|
782
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
|
783
|
+
data(data),
|
|
784
|
+
flags(flags) {}
|
|
785
|
+
|
|
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,
|
|
807
|
+
GenericNamedPropertySetterCallback setter = nullptr,
|
|
808
|
+
GenericNamedPropertyQueryCallback query = nullptr,
|
|
809
|
+
GenericNamedPropertyDeleterCallback deleter = nullptr,
|
|
810
|
+
GenericNamedPropertyEnumeratorCallback enumerator = nullptr,
|
|
811
|
+
Local<Value> data = Local<Value>(),
|
|
812
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
|
813
|
+
: getter(reinterpret_cast<void*>(getter)),
|
|
814
|
+
setter(reinterpret_cast<void*>(setter)),
|
|
815
|
+
query(reinterpret_cast<void*>(query)),
|
|
816
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
|
817
|
+
enumerator(enumerator),
|
|
818
|
+
definer(nullptr),
|
|
819
|
+
descriptor(nullptr),
|
|
820
|
+
data(data),
|
|
821
|
+
flags(flags) {}
|
|
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.
|
|
843
|
+
NamedPropertyHandlerConfiguration(
|
|
844
|
+
GenericNamedPropertyGetterCallback getter,
|
|
845
|
+
GenericNamedPropertySetterCallback setter,
|
|
846
|
+
GenericNamedPropertyDescriptorCallback descriptor,
|
|
847
|
+
GenericNamedPropertyDeleterCallback deleter,
|
|
848
|
+
GenericNamedPropertyEnumeratorCallback enumerator,
|
|
849
|
+
GenericNamedPropertyDefinerCallback definer,
|
|
850
|
+
Local<Value> data = Local<Value>(),
|
|
851
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
|
852
|
+
: getter(reinterpret_cast<void*>(getter)),
|
|
853
|
+
setter(reinterpret_cast<void*>(setter)),
|
|
854
|
+
query(nullptr),
|
|
855
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
|
856
|
+
enumerator(enumerator),
|
|
857
|
+
definer(reinterpret_cast<void*>(definer)),
|
|
858
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
|
859
|
+
data(data),
|
|
860
|
+
flags(flags) {}
|
|
861
|
+
|
|
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
|
|
869
|
+
Local<Value> data;
|
|
870
|
+
PropertyHandlerFlags flags;
|
|
871
|
+
};
|
|
872
|
+
|
|
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:
|
|
884
|
+
IndexedPropertyHandlerConfiguration(
|
|
885
|
+
IndexedPropertyGetterCallbackV2 getter, //
|
|
886
|
+
IndexedPropertySetterCallbackV2 setter, //
|
|
887
|
+
IndexedPropertyQueryCallbackV2 query, //
|
|
888
|
+
IndexedPropertyDeleterCallbackV2 deleter, //
|
|
889
|
+
IndexedPropertyEnumeratorCallback enumerator, //
|
|
890
|
+
IndexedPropertyDefinerCallbackV2 definer, //
|
|
891
|
+
IndexedPropertyDescriptorCallbackV2 descriptor, //
|
|
892
|
+
Local<Value> data = Local<Value>(),
|
|
893
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
|
894
|
+
: getter(reinterpret_cast<void*>(getter)),
|
|
895
|
+
setter(reinterpret_cast<void*>(setter)),
|
|
896
|
+
query(reinterpret_cast<void*>(query)),
|
|
897
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
|
898
|
+
enumerator(enumerator),
|
|
899
|
+
definer(reinterpret_cast<void*>(definer)),
|
|
900
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
|
901
|
+
data(data),
|
|
902
|
+
flags(WithNewSignatureFlag(flags)) {}
|
|
903
|
+
|
|
904
|
+
// This variant will be deprecated soon.
|
|
905
|
+
IndexedPropertyHandlerConfiguration(
|
|
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,
|
|
946
|
+
IndexedPropertySetterCallback setter = nullptr,
|
|
947
|
+
IndexedPropertyQueryCallback query = nullptr,
|
|
948
|
+
IndexedPropertyDeleterCallback deleter = nullptr,
|
|
949
|
+
IndexedPropertyEnumeratorCallback enumerator = nullptr,
|
|
950
|
+
Local<Value> data = Local<Value>(),
|
|
951
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
|
952
|
+
: getter(reinterpret_cast<void*>(getter)),
|
|
953
|
+
setter(reinterpret_cast<void*>(setter)),
|
|
954
|
+
query(reinterpret_cast<void*>(query)),
|
|
955
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
|
956
|
+
enumerator(enumerator),
|
|
957
|
+
definer(nullptr),
|
|
958
|
+
descriptor(nullptr),
|
|
959
|
+
data(data),
|
|
960
|
+
flags(flags) {}
|
|
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.
|
|
982
|
+
IndexedPropertyHandlerConfiguration(
|
|
983
|
+
IndexedPropertyGetterCallback getter,
|
|
984
|
+
IndexedPropertySetterCallback setter,
|
|
985
|
+
IndexedPropertyDescriptorCallback descriptor,
|
|
986
|
+
IndexedPropertyDeleterCallback deleter,
|
|
987
|
+
IndexedPropertyEnumeratorCallback enumerator,
|
|
988
|
+
IndexedPropertyDefinerCallback definer,
|
|
989
|
+
Local<Value> data = Local<Value>(),
|
|
990
|
+
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
|
|
991
|
+
: getter(reinterpret_cast<void*>(getter)),
|
|
992
|
+
setter(reinterpret_cast<void*>(setter)),
|
|
993
|
+
query(nullptr),
|
|
994
|
+
deleter(reinterpret_cast<void*>(deleter)),
|
|
995
|
+
enumerator(enumerator),
|
|
996
|
+
definer(reinterpret_cast<void*>(definer)),
|
|
997
|
+
descriptor(reinterpret_cast<void*>(descriptor)),
|
|
998
|
+
data(data),
|
|
999
|
+
flags(flags) {}
|
|
1000
|
+
|
|
1001
|
+
void* getter; // IndexedPropertyGetterCallback[V2]
|
|
1002
|
+
void* setter; // IndexedPropertySetterCallback[V2]
|
|
1003
|
+
void* query; // IndexedPropertyQueryCallback[V2]
|
|
1004
|
+
void* deleter; // IndexedPropertyDeleterCallback[V2]
|
|
1005
|
+
IndexedPropertyEnumeratorCallback enumerator;
|
|
1006
|
+
void* definer; // IndexedPropertyDefinerCallback[V2]
|
|
1007
|
+
void* descriptor; // IndexedPropertyDescriptorCallback[V2]
|
|
1008
|
+
Local<Value> data;
|
|
1009
|
+
PropertyHandlerFlags flags;
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* An ObjectTemplate is used to create objects at runtime.
|
|
1014
|
+
*
|
|
1015
|
+
* Properties added to an ObjectTemplate are added to each object
|
|
1016
|
+
* created from the ObjectTemplate.
|
|
1017
|
+
*/
|
|
1018
|
+
class V8_EXPORT ObjectTemplate : public Template {
|
|
1019
|
+
public:
|
|
1020
|
+
/** Creates an ObjectTemplate. */
|
|
1021
|
+
static Local<ObjectTemplate> New(
|
|
1022
|
+
Isolate* isolate,
|
|
1023
|
+
Local<FunctionTemplate> constructor = Local<FunctionTemplate>());
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Creates a new instance of this template.
|
|
1027
|
+
*
|
|
1028
|
+
* \param context The context in which the instance is created.
|
|
1029
|
+
*/
|
|
1030
|
+
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Sets an accessor on the object template.
|
|
1034
|
+
*
|
|
1035
|
+
* Whenever the property with the given name is accessed on objects
|
|
1036
|
+
* created from this ObjectTemplate the getter and setter callbacks
|
|
1037
|
+
* are called instead of getting and setting the property directly
|
|
1038
|
+
* on the JavaScript object.
|
|
1039
|
+
*
|
|
1040
|
+
* \param name The name of the property for which an accessor is added.
|
|
1041
|
+
* \param getter The callback to invoke when getting the property.
|
|
1042
|
+
* \param setter The callback to invoke when setting the property.
|
|
1043
|
+
* \param data A piece of data that will be passed to the getter and setter
|
|
1044
|
+
* callbacks whenever they are invoked.
|
|
1045
|
+
* \param attribute The attributes of the property for which an accessor
|
|
1046
|
+
* is added.
|
|
1047
|
+
*/
|
|
1048
|
+
V8_DEPRECATE_SOON("Use SetAccessor with Local<Name> instead")
|
|
1049
|
+
void SetAccessor(
|
|
1050
|
+
Local<String> name, AccessorGetterCallback getter,
|
|
1051
|
+
AccessorSetterCallback setter = nullptr,
|
|
1052
|
+
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
|
1053
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
|
1054
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
|
1055
|
+
void SetAccessor(
|
|
1056
|
+
Local<Name> name, AccessorNameGetterCallback getter,
|
|
1057
|
+
AccessorNameSetterCallback setter = nullptr,
|
|
1058
|
+
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
|
1059
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
|
1060
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Sets a named property handler on the object template.
|
|
1064
|
+
*
|
|
1065
|
+
* Whenever a property whose name is a string or a symbol is accessed on
|
|
1066
|
+
* objects created from this object template, the provided callback is
|
|
1067
|
+
* invoked instead of accessing the property directly on the JavaScript
|
|
1068
|
+
* object.
|
|
1069
|
+
*
|
|
1070
|
+
* @param configuration The NamedPropertyHandlerConfiguration that defines the
|
|
1071
|
+
* callbacks to invoke when accessing a property.
|
|
1072
|
+
*/
|
|
1073
|
+
void SetHandler(const NamedPropertyHandlerConfiguration& configuration);
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Sets an indexed property handler on the object template.
|
|
1077
|
+
*
|
|
1078
|
+
* Whenever an indexed property is accessed on objects created from
|
|
1079
|
+
* this object template, the provided callback is invoked instead of
|
|
1080
|
+
* accessing the property directly on the JavaScript object.
|
|
1081
|
+
*
|
|
1082
|
+
* \param getter The callback to invoke when getting a property.
|
|
1083
|
+
* \param setter The callback to invoke when setting a property.
|
|
1084
|
+
* \param query The callback to invoke to check if an object has a property.
|
|
1085
|
+
* \param deleter The callback to invoke when deleting a property.
|
|
1086
|
+
* \param enumerator The callback to invoke to enumerate all the indexed
|
|
1087
|
+
* properties of an object.
|
|
1088
|
+
* \param data A piece of data that will be passed to the callbacks
|
|
1089
|
+
* whenever they are invoked.
|
|
1090
|
+
*/
|
|
1091
|
+
V8_DEPRECATE_SOON("Use SetHandler instead")
|
|
1092
|
+
void SetIndexedPropertyHandler(
|
|
1093
|
+
IndexedPropertyGetterCallback getter,
|
|
1094
|
+
IndexedPropertySetterCallback setter = nullptr,
|
|
1095
|
+
IndexedPropertyQueryCallback query = nullptr,
|
|
1096
|
+
IndexedPropertyDeleterCallback deleter = nullptr,
|
|
1097
|
+
IndexedPropertyEnumeratorCallback enumerator = nullptr,
|
|
1098
|
+
Local<Value> data = Local<Value>()) {
|
|
1099
|
+
SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
|
|
1100
|
+
deleter, enumerator, data));
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Sets an indexed property handler on the object template.
|
|
1105
|
+
*
|
|
1106
|
+
* Whenever an indexed property is accessed on objects created from
|
|
1107
|
+
* this object template, the provided callback is invoked instead of
|
|
1108
|
+
* accessing the property directly on the JavaScript object.
|
|
1109
|
+
*
|
|
1110
|
+
* @param configuration The IndexedPropertyHandlerConfiguration that defines
|
|
1111
|
+
* the callbacks to invoke when accessing a property.
|
|
1112
|
+
*/
|
|
1113
|
+
void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Sets the callback to be used when calling instances created from
|
|
1117
|
+
* this template as a function. If no callback is set, instances
|
|
1118
|
+
* behave like normal JavaScript objects that cannot be called as a
|
|
1119
|
+
* function.
|
|
1120
|
+
*/
|
|
1121
|
+
void SetCallAsFunctionHandler(FunctionCallback callback,
|
|
1122
|
+
Local<Value> data = Local<Value>());
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Mark object instances of the template as undetectable.
|
|
1126
|
+
*
|
|
1127
|
+
* In many ways, undetectable objects behave as though they are not
|
|
1128
|
+
* there. They behave like 'undefined' in conditionals and when
|
|
1129
|
+
* printed. However, properties can be accessed and called as on
|
|
1130
|
+
* normal objects.
|
|
1131
|
+
*/
|
|
1132
|
+
void MarkAsUndetectable();
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* Sets access check callback on the object template and enables access
|
|
1136
|
+
* checks.
|
|
1137
|
+
*
|
|
1138
|
+
* When accessing properties on instances of this object template,
|
|
1139
|
+
* the access check callback will be called to determine whether or
|
|
1140
|
+
* not to allow cross-context access to the properties.
|
|
1141
|
+
*/
|
|
1142
|
+
void SetAccessCheckCallback(AccessCheckCallback callback,
|
|
1143
|
+
Local<Value> data = Local<Value>());
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Like SetAccessCheckCallback but invokes an interceptor on failed access
|
|
1147
|
+
* checks instead of looking up all-can-read properties. You can only use
|
|
1148
|
+
* either this method or SetAccessCheckCallback, but not both at the same
|
|
1149
|
+
* time.
|
|
1150
|
+
*/
|
|
1151
|
+
void SetAccessCheckCallbackAndHandler(
|
|
1152
|
+
AccessCheckCallback callback,
|
|
1153
|
+
const NamedPropertyHandlerConfiguration& named_handler,
|
|
1154
|
+
const IndexedPropertyHandlerConfiguration& indexed_handler,
|
|
1155
|
+
Local<Value> data = Local<Value>());
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Gets the number of internal fields for objects generated from
|
|
1159
|
+
* this template.
|
|
1160
|
+
*/
|
|
1161
|
+
int InternalFieldCount() const;
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Sets the number of internal fields for objects generated from
|
|
1165
|
+
* this template.
|
|
1166
|
+
*/
|
|
1167
|
+
void SetInternalFieldCount(int value);
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Returns true if the object will be an immutable prototype exotic object.
|
|
1171
|
+
*/
|
|
1172
|
+
bool IsImmutableProto() const;
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Makes the ObjectTemplate for an immutable prototype exotic object, with an
|
|
1176
|
+
* immutable __proto__.
|
|
1177
|
+
*/
|
|
1178
|
+
void SetImmutableProto();
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* Support for TC39 "dynamic code brand checks" proposal.
|
|
1182
|
+
*
|
|
1183
|
+
* This API allows to mark (& query) objects as "code like", which causes
|
|
1184
|
+
* them to be treated like Strings in the context of eval and function
|
|
1185
|
+
* constructor.
|
|
1186
|
+
*
|
|
1187
|
+
* Reference: https://github.com/tc39/proposal-dynamic-code-brand-checks
|
|
1188
|
+
*/
|
|
1189
|
+
void SetCodeLike();
|
|
1190
|
+
bool IsCodeLike() const;
|
|
1191
|
+
|
|
1192
|
+
V8_INLINE static ObjectTemplate* Cast(Data* data);
|
|
1193
|
+
|
|
1194
|
+
private:
|
|
1195
|
+
ObjectTemplate();
|
|
1196
|
+
|
|
1197
|
+
static void CheckCast(Data* that);
|
|
1198
|
+
friend class FunctionTemplate;
|
|
1199
|
+
};
|
|
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
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* A Signature specifies which receiver is valid for a function.
|
|
1238
|
+
*
|
|
1239
|
+
* A receiver matches a given signature if the receiver (or any of its
|
|
1240
|
+
* hidden prototypes) was created from the signature's FunctionTemplate, or
|
|
1241
|
+
* from a FunctionTemplate that inherits directly or indirectly from the
|
|
1242
|
+
* signature's FunctionTemplate.
|
|
1243
|
+
*/
|
|
1244
|
+
class V8_EXPORT Signature : public Data {
|
|
1245
|
+
public:
|
|
1246
|
+
static Local<Signature> New(
|
|
1247
|
+
Isolate* isolate,
|
|
1248
|
+
Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
|
|
1249
|
+
|
|
1250
|
+
V8_INLINE static Signature* Cast(Data* data);
|
|
1251
|
+
|
|
1252
|
+
private:
|
|
1253
|
+
Signature();
|
|
1254
|
+
|
|
1255
|
+
static void CheckCast(Data* that);
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
// --- Implementation ---
|
|
1259
|
+
|
|
1260
|
+
void Template::Set(Isolate* isolate, const char* name, Local<Data> value,
|
|
1261
|
+
PropertyAttribute attributes) {
|
|
1262
|
+
Set(String::NewFromUtf8(isolate, name, NewStringType::kInternalized)
|
|
1263
|
+
.ToLocalChecked(),
|
|
1264
|
+
value, attributes);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
FunctionTemplate* FunctionTemplate::Cast(Data* data) {
|
|
1268
|
+
#ifdef V8_ENABLE_CHECKS
|
|
1269
|
+
CheckCast(data);
|
|
1270
|
+
#endif
|
|
1271
|
+
return reinterpret_cast<FunctionTemplate*>(data);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
ObjectTemplate* ObjectTemplate::Cast(Data* data) {
|
|
1275
|
+
#ifdef V8_ENABLE_CHECKS
|
|
1276
|
+
CheckCast(data);
|
|
1277
|
+
#endif
|
|
1278
|
+
return reinterpret_cast<ObjectTemplate*>(data);
|
|
1279
|
+
}
|
|
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
|
+
|
|
1288
|
+
Signature* Signature::Cast(Data* data) {
|
|
1289
|
+
#ifdef V8_ENABLE_CHECKS
|
|
1290
|
+
CheckCast(data);
|
|
1291
|
+
#endif
|
|
1292
|
+
return reinterpret_cast<Signature*>(data);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
} // namespace v8
|
|
1296
|
+
|
|
1297
|
+
#endif // INCLUDE_V8_TEMPLATE_H_
|