@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,380 @@
|
|
|
1
|
+
#ifndef SRC_NODE_ERRORS_H_
|
|
2
|
+
#define SRC_NODE_ERRORS_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "debug_utils-inl.h"
|
|
7
|
+
#include "env.h"
|
|
8
|
+
#include "node_buffer.h"
|
|
9
|
+
#include "v8.h"
|
|
10
|
+
|
|
11
|
+
// Use ostringstream to print exact-width integer types
|
|
12
|
+
// because the format specifiers are not available on AIX.
|
|
13
|
+
#include <sstream>
|
|
14
|
+
|
|
15
|
+
namespace node {
|
|
16
|
+
// This forward declaration is required to have the method
|
|
17
|
+
// available in error messages.
|
|
18
|
+
namespace errors {
|
|
19
|
+
const char* errno_string(int errorno);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
enum ErrorHandlingMode { CONTEXTIFY_ERROR, FATAL_ERROR, MODULE_ERROR };
|
|
23
|
+
void AppendExceptionLine(Environment* env,
|
|
24
|
+
v8::Local<v8::Value> er,
|
|
25
|
+
v8::Local<v8::Message> message,
|
|
26
|
+
enum ErrorHandlingMode mode);
|
|
27
|
+
|
|
28
|
+
// This function calls backtrace, it should have not be marked as [[noreturn]].
|
|
29
|
+
// But it is a public API, removing the attribute can break.
|
|
30
|
+
// Prefer UNREACHABLE() internally instead, it doesn't need manually set
|
|
31
|
+
// location.
|
|
32
|
+
[[noreturn]] void OnFatalError(const char* location, const char* message);
|
|
33
|
+
// This function calls backtrace, do not mark as [[noreturn]]. Read more in the
|
|
34
|
+
// ABORT macro.
|
|
35
|
+
void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
|
|
36
|
+
|
|
37
|
+
// Helpers to construct errors similar to the ones provided by
|
|
38
|
+
// lib/internal/errors.js.
|
|
39
|
+
// Example: with `V(ERR_INVALID_ARG_TYPE, TypeError)`, there will be
|
|
40
|
+
// `node::ERR_INVALID_ARG_TYPE(isolate, "message")` returning
|
|
41
|
+
// a `Local<Value>` containing the TypeError with proper code and message
|
|
42
|
+
|
|
43
|
+
#define ERRORS_WITH_CODE(V) \
|
|
44
|
+
V(ERR_ACCESS_DENIED, Error) \
|
|
45
|
+
V(ERR_BUFFER_CONTEXT_NOT_AVAILABLE, Error) \
|
|
46
|
+
V(ERR_BUFFER_OUT_OF_BOUNDS, RangeError) \
|
|
47
|
+
V(ERR_BUFFER_TOO_LARGE, Error) \
|
|
48
|
+
V(ERR_CLOSED_MESSAGE_PORT, Error) \
|
|
49
|
+
V(ERR_CONSTRUCT_CALL_REQUIRED, TypeError) \
|
|
50
|
+
V(ERR_CONSTRUCT_CALL_INVALID, TypeError) \
|
|
51
|
+
V(ERR_CPU_PROFILE_ALREADY_STARTED, Error) \
|
|
52
|
+
V(ERR_CPU_PROFILE_NOT_STARTED, Error) \
|
|
53
|
+
V(ERR_CPU_PROFILE_TOO_MANY, Error) \
|
|
54
|
+
V(ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED, Error) \
|
|
55
|
+
V(ERR_CRYPTO_INITIALIZATION_FAILED, Error) \
|
|
56
|
+
V(ERR_CRYPTO_INVALID_AUTH_TAG, TypeError) \
|
|
57
|
+
V(ERR_CRYPTO_INVALID_COUNTER, TypeError) \
|
|
58
|
+
V(ERR_CRYPTO_INVALID_CURVE, TypeError) \
|
|
59
|
+
V(ERR_CRYPTO_INVALID_DIGEST, TypeError) \
|
|
60
|
+
V(ERR_CRYPTO_INVALID_IV, TypeError) \
|
|
61
|
+
V(ERR_CRYPTO_INVALID_JWK, TypeError) \
|
|
62
|
+
V(ERR_CRYPTO_INVALID_KEYLEN, RangeError) \
|
|
63
|
+
V(ERR_CRYPTO_INVALID_KEYPAIR, RangeError) \
|
|
64
|
+
V(ERR_CRYPTO_INVALID_KEYTYPE, RangeError) \
|
|
65
|
+
V(ERR_CRYPTO_INVALID_MESSAGELEN, RangeError) \
|
|
66
|
+
V(ERR_CRYPTO_INVALID_SCRYPT_PARAMS, RangeError) \
|
|
67
|
+
V(ERR_CRYPTO_INVALID_STATE, Error) \
|
|
68
|
+
V(ERR_CRYPTO_INVALID_TAG_LENGTH, RangeError) \
|
|
69
|
+
V(ERR_CRYPTO_JWK_UNSUPPORTED_CURVE, Error) \
|
|
70
|
+
V(ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE, Error) \
|
|
71
|
+
V(ERR_CRYPTO_OPERATION_FAILED, Error) \
|
|
72
|
+
V(ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH, RangeError) \
|
|
73
|
+
V(ERR_CRYPTO_UNKNOWN_CIPHER, Error) \
|
|
74
|
+
V(ERR_CRYPTO_UNKNOWN_DH_GROUP, Error) \
|
|
75
|
+
V(ERR_CRYPTO_UNSUPPORTED_OPERATION, Error) \
|
|
76
|
+
V(ERR_CRYPTO_JOB_INIT_FAILED, Error) \
|
|
77
|
+
V(ERR_DLOPEN_DISABLED, Error) \
|
|
78
|
+
V(ERR_DLOPEN_FAILED, Error) \
|
|
79
|
+
V(ERR_ENCODING_INVALID_ENCODED_DATA, TypeError) \
|
|
80
|
+
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, Error) \
|
|
81
|
+
V(ERR_FS_CP_EINVAL, Error) \
|
|
82
|
+
V(ERR_FS_CP_DIR_TO_NON_DIR, Error) \
|
|
83
|
+
V(ERR_FS_CP_NON_DIR_TO_DIR, Error) \
|
|
84
|
+
V(ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY, Error) \
|
|
85
|
+
V(ERR_FS_EISDIR, Error) \
|
|
86
|
+
V(ERR_FS_CP_EEXIST, Error) \
|
|
87
|
+
V(ERR_FS_CP_SOCKET, Error) \
|
|
88
|
+
V(ERR_FS_CP_FIFO_PIPE, Error) \
|
|
89
|
+
V(ERR_FS_CP_UNKNOWN, Error) \
|
|
90
|
+
V(ERR_ILLEGAL_CONSTRUCTOR, Error) \
|
|
91
|
+
V(ERR_INVALID_ADDRESS, Error) \
|
|
92
|
+
V(ERR_INVALID_ARG_VALUE, TypeError) \
|
|
93
|
+
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \
|
|
94
|
+
V(ERR_INVALID_ARG_TYPE, TypeError) \
|
|
95
|
+
V(ERR_INVALID_FILE_URL_HOST, TypeError) \
|
|
96
|
+
V(ERR_INVALID_FILE_URL_PATH, TypeError) \
|
|
97
|
+
V(ERR_INVALID_INVOCATION, TypeError) \
|
|
98
|
+
V(ERR_INVALID_PACKAGE_CONFIG, Error) \
|
|
99
|
+
V(ERR_INVALID_OBJECT_DEFINE_PROPERTY, TypeError) \
|
|
100
|
+
V(ERR_INVALID_MODULE, Error) \
|
|
101
|
+
V(ERR_INVALID_STATE, Error) \
|
|
102
|
+
V(ERR_INVALID_THIS, TypeError) \
|
|
103
|
+
V(ERR_INVALID_URL, TypeError) \
|
|
104
|
+
V(ERR_INVALID_URL_SCHEME, TypeError) \
|
|
105
|
+
V(ERR_LOAD_SQLITE_EXTENSION, Error) \
|
|
106
|
+
V(ERR_MEMORY_ALLOCATION_FAILED, Error) \
|
|
107
|
+
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \
|
|
108
|
+
V(ERR_MISSING_ARGS, TypeError) \
|
|
109
|
+
V(ERR_MISSING_PASSPHRASE, TypeError) \
|
|
110
|
+
V(ERR_MISSING_PLATFORM_FOR_WORKER, Error) \
|
|
111
|
+
V(ERR_MODULE_NOT_FOUND, Error) \
|
|
112
|
+
V(ERR_MODULE_LINK_MISMATCH, TypeError) \
|
|
113
|
+
V(ERR_NON_CONTEXT_AWARE_DISABLED, Error) \
|
|
114
|
+
V(ERR_OPTIONS_BEFORE_BOOTSTRAPPING, Error) \
|
|
115
|
+
V(ERR_OUT_OF_RANGE, RangeError) \
|
|
116
|
+
V(ERR_REQUIRE_ASYNC_MODULE, Error) \
|
|
117
|
+
V(ERR_SCRIPT_EXECUTION_INTERRUPTED, Error) \
|
|
118
|
+
V(ERR_SCRIPT_EXECUTION_TIMEOUT, Error) \
|
|
119
|
+
V(ERR_STRING_TOO_LONG, Error) \
|
|
120
|
+
V(ERR_TLS_INVALID_PROTOCOL_METHOD, TypeError) \
|
|
121
|
+
V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \
|
|
122
|
+
V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \
|
|
123
|
+
V(ERR_VM_MODULE_LINK_FAILURE, Error) \
|
|
124
|
+
V(ERR_WASI_NOT_STARTED, Error) \
|
|
125
|
+
V(ERR_ZLIB_INITIALIZATION_FAILED, Error) \
|
|
126
|
+
V(ERR_WORKER_INIT_FAILED, Error) \
|
|
127
|
+
V(ERR_PROTO_ACCESS, Error)
|
|
128
|
+
|
|
129
|
+
// If the macros are used as ERR_*(isolate, message) or
|
|
130
|
+
// THROW_ERR_*(isolate, message) with a single string argument, do run
|
|
131
|
+
// formatter on the message, and allow the caller to pass in a message
|
|
132
|
+
// directly with characters that would otherwise need escaping if used
|
|
133
|
+
// as format string unconditionally.
|
|
134
|
+
#define V(code, type) \
|
|
135
|
+
template <typename... Args> \
|
|
136
|
+
inline v8::Local<v8::Object> code( \
|
|
137
|
+
v8::Isolate* isolate, std::string_view format, Args&&... args) { \
|
|
138
|
+
std::string message; \
|
|
139
|
+
if (sizeof...(Args) == 0) { \
|
|
140
|
+
message = format; \
|
|
141
|
+
} else { \
|
|
142
|
+
message = SPrintF(format, std::forward<Args>(args)...); \
|
|
143
|
+
} \
|
|
144
|
+
v8::Local<v8::String> js_code = FIXED_ONE_BYTE_STRING(isolate, #code); \
|
|
145
|
+
v8::Local<v8::String> js_msg = \
|
|
146
|
+
v8::String::NewFromUtf8(isolate, \
|
|
147
|
+
message.c_str(), \
|
|
148
|
+
v8::NewStringType::kNormal, \
|
|
149
|
+
message.length()) \
|
|
150
|
+
.ToLocalChecked(); \
|
|
151
|
+
v8::Local<v8::Object> e = v8::Exception::type(js_msg) \
|
|
152
|
+
->ToObject(isolate->GetCurrentContext()) \
|
|
153
|
+
.ToLocalChecked(); \
|
|
154
|
+
e->Set(isolate->GetCurrentContext(), \
|
|
155
|
+
FIXED_ONE_BYTE_STRING(isolate, "code"), \
|
|
156
|
+
js_code) \
|
|
157
|
+
.Check(); \
|
|
158
|
+
return e; \
|
|
159
|
+
} \
|
|
160
|
+
template <typename... Args> \
|
|
161
|
+
inline void THROW_##code( \
|
|
162
|
+
v8::Isolate* isolate, std::string_view format, Args&&... args) { \
|
|
163
|
+
isolate->ThrowException( \
|
|
164
|
+
code(isolate, format, std::forward<Args>(args)...)); \
|
|
165
|
+
} \
|
|
166
|
+
template <typename... Args> \
|
|
167
|
+
inline void THROW_##code( \
|
|
168
|
+
Environment* env, std::string_view format, Args&&... args) { \
|
|
169
|
+
THROW_##code(env->isolate(), format, std::forward<Args>(args)...); \
|
|
170
|
+
} \
|
|
171
|
+
template <typename... Args> \
|
|
172
|
+
inline void THROW_##code( \
|
|
173
|
+
Realm* realm, std::string_view format, Args&&... args) { \
|
|
174
|
+
THROW_##code(realm->isolate(), format, std::forward<Args>(args)...); \
|
|
175
|
+
}
|
|
176
|
+
ERRORS_WITH_CODE(V)
|
|
177
|
+
#undef V
|
|
178
|
+
|
|
179
|
+
// Errors with predefined static messages
|
|
180
|
+
|
|
181
|
+
#define PREDEFINED_ERROR_MESSAGES(V) \
|
|
182
|
+
V(ERR_ACCESS_DENIED, "Access to this API has been restricted") \
|
|
183
|
+
V(ERR_BUFFER_CONTEXT_NOT_AVAILABLE, \
|
|
184
|
+
"Buffer is not available for the current Context") \
|
|
185
|
+
V(ERR_CLOSED_MESSAGE_PORT, "Cannot send data on closed MessagePort") \
|
|
186
|
+
V(ERR_CONSTRUCT_CALL_INVALID, "Constructor cannot be called") \
|
|
187
|
+
V(ERR_CONSTRUCT_CALL_REQUIRED, "Cannot call constructor without `new`") \
|
|
188
|
+
V(ERR_CRYPTO_INITIALIZATION_FAILED, "Initialization failed") \
|
|
189
|
+
V(ERR_CRYPTO_INVALID_AUTH_TAG, "Invalid authentication tag") \
|
|
190
|
+
V(ERR_CRYPTO_INVALID_COUNTER, "Invalid counter") \
|
|
191
|
+
V(ERR_CRYPTO_INVALID_CURVE, "Invalid EC curve name") \
|
|
192
|
+
V(ERR_CRYPTO_INVALID_DIGEST, "Invalid digest") \
|
|
193
|
+
V(ERR_CRYPTO_INVALID_IV, "Invalid initialization vector") \
|
|
194
|
+
V(ERR_CRYPTO_INVALID_JWK, "Invalid JWK format") \
|
|
195
|
+
V(ERR_CRYPTO_INVALID_KEYLEN, "Invalid key length") \
|
|
196
|
+
V(ERR_CRYPTO_INVALID_KEYPAIR, "Invalid key pair") \
|
|
197
|
+
V(ERR_CRYPTO_INVALID_KEYTYPE, "Invalid key type") \
|
|
198
|
+
V(ERR_CRYPTO_INVALID_MESSAGELEN, "Invalid message length") \
|
|
199
|
+
V(ERR_CRYPTO_INVALID_SCRYPT_PARAMS, "Invalid scrypt params") \
|
|
200
|
+
V(ERR_CRYPTO_INVALID_STATE, "Invalid state") \
|
|
201
|
+
V(ERR_CRYPTO_INVALID_TAG_LENGTH, "Invalid taglength") \
|
|
202
|
+
V(ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE, "Unsupported JWK Key Type.") \
|
|
203
|
+
V(ERR_CRYPTO_OPERATION_FAILED, "Operation failed") \
|
|
204
|
+
V(ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH, \
|
|
205
|
+
"Input buffers must have the same byte length") \
|
|
206
|
+
V(ERR_CRYPTO_UNKNOWN_CIPHER, "Unknown cipher") \
|
|
207
|
+
V(ERR_CRYPTO_UNKNOWN_DH_GROUP, "Unknown DH group") \
|
|
208
|
+
V(ERR_CRYPTO_UNSUPPORTED_OPERATION, "Unsupported crypto operation") \
|
|
209
|
+
V(ERR_CRYPTO_JOB_INIT_FAILED, "Failed to initialize crypto job config") \
|
|
210
|
+
V(ERR_DLOPEN_FAILED, "DLOpen failed") \
|
|
211
|
+
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \
|
|
212
|
+
"Context not associated with Node.js environment") \
|
|
213
|
+
V(ERR_ILLEGAL_CONSTRUCTOR, "Illegal constructor") \
|
|
214
|
+
V(ERR_INVALID_ADDRESS, "Invalid socket address") \
|
|
215
|
+
V(ERR_INVALID_INVOCATION, "Invalid invocation") \
|
|
216
|
+
V(ERR_INVALID_MODULE, "No such module") \
|
|
217
|
+
V(ERR_INVALID_STATE, "Invalid state") \
|
|
218
|
+
V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \
|
|
219
|
+
V(ERR_INVALID_URL_SCHEME, "The URL must be of scheme file:") \
|
|
220
|
+
V(ERR_LOAD_SQLITE_EXTENSION, "Failed to load SQLite extension") \
|
|
221
|
+
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \
|
|
222
|
+
V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \
|
|
223
|
+
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, \
|
|
224
|
+
"A message object could not be deserialized successfully in the target " \
|
|
225
|
+
"vm.Context") \
|
|
226
|
+
V(ERR_MISSING_PLATFORM_FOR_WORKER, \
|
|
227
|
+
"The V8 platform used by this instance of Node does not support " \
|
|
228
|
+
"creating Workers") \
|
|
229
|
+
V(ERR_NON_CONTEXT_AWARE_DISABLED, \
|
|
230
|
+
"Loading non context-aware native addons has been disabled") \
|
|
231
|
+
V(ERR_SCRIPT_EXECUTION_INTERRUPTED, \
|
|
232
|
+
"Script execution was interrupted by `SIGINT`") \
|
|
233
|
+
V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \
|
|
234
|
+
V(ERR_WASI_NOT_STARTED, "wasi.start() has not been called") \
|
|
235
|
+
V(ERR_WORKER_INIT_FAILED, "Worker initialization failure") \
|
|
236
|
+
V(ERR_PROTO_ACCESS, \
|
|
237
|
+
"Accessing Object.prototype.__proto__ has been " \
|
|
238
|
+
"disallowed with --disable-proto=throw")
|
|
239
|
+
|
|
240
|
+
#define V(code, message) \
|
|
241
|
+
inline v8::Local<v8::Object> code(v8::Isolate* isolate) { \
|
|
242
|
+
return code(isolate, message); \
|
|
243
|
+
} \
|
|
244
|
+
inline void THROW_##code(v8::Isolate* isolate) { \
|
|
245
|
+
isolate->ThrowException(code(isolate, message)); \
|
|
246
|
+
} \
|
|
247
|
+
inline void THROW_##code(Environment* env) { THROW_##code(env->isolate()); }
|
|
248
|
+
PREDEFINED_ERROR_MESSAGES(V)
|
|
249
|
+
#undef V
|
|
250
|
+
|
|
251
|
+
// Errors with predefined non-static messages
|
|
252
|
+
inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,
|
|
253
|
+
int64_t timeout) {
|
|
254
|
+
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(
|
|
255
|
+
env, "Script execution timed out after %dms", timeout);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
inline void THROW_ERR_REQUIRE_ASYNC_MODULE(
|
|
259
|
+
Environment* env,
|
|
260
|
+
v8::Local<v8::Value> filename,
|
|
261
|
+
v8::Local<v8::Value> parent_filename) {
|
|
262
|
+
static constexpr const char* prefix =
|
|
263
|
+
"require() cannot be used on an ESM graph with top-level await. Use "
|
|
264
|
+
"import() instead. To see where the top-level await comes from, use "
|
|
265
|
+
"--experimental-print-required-tla.";
|
|
266
|
+
std::string message = prefix;
|
|
267
|
+
if (!parent_filename.IsEmpty() && parent_filename->IsString()) {
|
|
268
|
+
Utf8Value utf8(env->isolate(), parent_filename);
|
|
269
|
+
message += "\n From ";
|
|
270
|
+
message += utf8.ToStringView();
|
|
271
|
+
}
|
|
272
|
+
if (!filename.IsEmpty() && filename->IsString()) {
|
|
273
|
+
Utf8Value utf8(env->isolate(), filename);
|
|
274
|
+
message += "\n Requiring ";
|
|
275
|
+
message += utf8.ToStringView();
|
|
276
|
+
}
|
|
277
|
+
THROW_ERR_REQUIRE_ASYNC_MODULE(env, message);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
inline v8::Local<v8::Object> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
|
|
281
|
+
char message[128];
|
|
282
|
+
snprintf(message,
|
|
283
|
+
sizeof(message),
|
|
284
|
+
"Cannot create a Buffer larger than 0x%zx bytes",
|
|
285
|
+
Buffer::kMaxLength);
|
|
286
|
+
return ERR_BUFFER_TOO_LARGE(isolate, message);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
inline v8::Local<v8::Object> ERR_STRING_TOO_LONG(v8::Isolate* isolate) {
|
|
290
|
+
char message[128];
|
|
291
|
+
snprintf(message, sizeof(message),
|
|
292
|
+
"Cannot create a string longer than 0x%x characters",
|
|
293
|
+
v8::String::kMaxLength);
|
|
294
|
+
return ERR_STRING_TOO_LONG(isolate, message);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
#define THROW_AND_RETURN_IF_NOT_BUFFER(env, val, prefix) \
|
|
298
|
+
do { \
|
|
299
|
+
if (!Buffer::HasInstance(val)) \
|
|
300
|
+
return node::THROW_ERR_INVALID_ARG_TYPE(env, \
|
|
301
|
+
prefix " must be a buffer"); \
|
|
302
|
+
} while (0)
|
|
303
|
+
|
|
304
|
+
#define THROW_AND_RETURN_IF_NOT_STRING(env, val, prefix) \
|
|
305
|
+
do { \
|
|
306
|
+
if (!val->IsString()) \
|
|
307
|
+
return node::THROW_ERR_INVALID_ARG_TYPE(env, \
|
|
308
|
+
prefix " must be a string"); \
|
|
309
|
+
} while (0)
|
|
310
|
+
|
|
311
|
+
namespace errors {
|
|
312
|
+
|
|
313
|
+
class TryCatchScope : public v8::TryCatch {
|
|
314
|
+
public:
|
|
315
|
+
enum class CatchMode { kNormal, kFatal, kFatalRethrowStackOverflow };
|
|
316
|
+
|
|
317
|
+
explicit TryCatchScope(Environment* env, CatchMode mode = CatchMode::kNormal)
|
|
318
|
+
: v8::TryCatch(env->isolate()), env_(env), mode_(mode) {}
|
|
319
|
+
~TryCatchScope();
|
|
320
|
+
|
|
321
|
+
// Since the dtor is not virtual we need to make sure no one creates
|
|
322
|
+
// object of it in the free store that might be held by polymorphic pointers.
|
|
323
|
+
void* operator new(std::size_t count) = delete;
|
|
324
|
+
void* operator new[](std::size_t count) = delete;
|
|
325
|
+
TryCatchScope(TryCatchScope&) = delete;
|
|
326
|
+
TryCatchScope(TryCatchScope&&) = delete;
|
|
327
|
+
TryCatchScope operator=(TryCatchScope&) = delete;
|
|
328
|
+
TryCatchScope operator=(TryCatchScope&&) = delete;
|
|
329
|
+
|
|
330
|
+
private:
|
|
331
|
+
Environment* env_;
|
|
332
|
+
CatchMode mode_;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// Trigger the global uncaught exception handler `process._fatalException`
|
|
336
|
+
// in JS land (which emits the 'uncaughtException' event). If that returns
|
|
337
|
+
// true, continue program execution, otherwise exit the process.
|
|
338
|
+
void TriggerUncaughtException(v8::Isolate* isolate,
|
|
339
|
+
const v8::TryCatch& try_catch);
|
|
340
|
+
void TriggerUncaughtException(v8::Isolate* isolate,
|
|
341
|
+
v8::Local<v8::Value> error,
|
|
342
|
+
v8::Local<v8::Message> message,
|
|
343
|
+
bool from_promise = false);
|
|
344
|
+
|
|
345
|
+
const char* errno_string(int errorno);
|
|
346
|
+
void PerIsolateMessageListener(v8::Local<v8::Message> message,
|
|
347
|
+
v8::Local<v8::Value> error);
|
|
348
|
+
|
|
349
|
+
void DecorateErrorStack(Environment* env,
|
|
350
|
+
const errors::TryCatchScope& try_catch);
|
|
351
|
+
void DecorateErrorStack(Environment* env,
|
|
352
|
+
v8::Local<v8::Value> error,
|
|
353
|
+
v8::Local<v8::Message> message);
|
|
354
|
+
|
|
355
|
+
class PrinterTryCatch : public v8::TryCatch {
|
|
356
|
+
public:
|
|
357
|
+
enum PrintSourceLine { kPrintSourceLine, kDontPrintSourceLine };
|
|
358
|
+
explicit PrinterTryCatch(v8::Isolate* isolate,
|
|
359
|
+
PrintSourceLine print_source_line)
|
|
360
|
+
: v8::TryCatch(isolate),
|
|
361
|
+
isolate_(isolate),
|
|
362
|
+
print_source_line_(print_source_line) {}
|
|
363
|
+
~PrinterTryCatch();
|
|
364
|
+
|
|
365
|
+
private:
|
|
366
|
+
v8::Isolate* isolate_;
|
|
367
|
+
PrintSourceLine print_source_line_;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
} // namespace errors
|
|
371
|
+
|
|
372
|
+
v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
|
|
373
|
+
v8::Local<v8::Context> context,
|
|
374
|
+
v8::Local<v8::Value> source,
|
|
375
|
+
bool is_code_like);
|
|
376
|
+
} // namespace node
|
|
377
|
+
|
|
378
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
379
|
+
|
|
380
|
+
#endif // SRC_NODE_ERRORS_H_
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#ifndef SRC_NODE_EXIT_CODE_H_
|
|
2
|
+
#define SRC_NODE_EXIT_CODE_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
namespace node {
|
|
7
|
+
#define EXIT_CODE_LIST(V) \
|
|
8
|
+
V(NoFailure, 0) \
|
|
9
|
+
/* 1 was intended for uncaught JS exceptions from the user land but we */ \
|
|
10
|
+
/* actually use this for all kinds of generic errors. */ \
|
|
11
|
+
V(GenericUserError, 1) \
|
|
12
|
+
/* 2 is unused */ \
|
|
13
|
+
/* 3 is actually unused because we pre-compile all builtins during */ \
|
|
14
|
+
/* snapshot building, when we exit with 1 if there's any error. */ \
|
|
15
|
+
V(InternalJSParseError, 3) \
|
|
16
|
+
/* 4 is actually unused. We exit with 1 in this case. */ \
|
|
17
|
+
V(InternalJSEvaluationFailure, 4) \
|
|
18
|
+
/* 5 is actually unused. We exit with 133 (128+SIGTRAP) or 134 */ \
|
|
19
|
+
/* (128+SIGABRT) in this case. */ \
|
|
20
|
+
V(V8FatalError, 5) \
|
|
21
|
+
V(InvalidFatalExceptionMonkeyPatching, 6) \
|
|
22
|
+
V(ExceptionInFatalExceptionHandler, 7) \
|
|
23
|
+
/* 8 is unused */ \
|
|
24
|
+
V(InvalidCommandLineArgument, 9) \
|
|
25
|
+
V(BootstrapFailure, 10) \
|
|
26
|
+
/* 11 is unused */ \
|
|
27
|
+
/* This was intended for invalid inspector arguments but is actually now */ \
|
|
28
|
+
/* just a duplicate of InvalidCommandLineArgument */ \
|
|
29
|
+
V(InvalidCommandLineArgument2, 12) \
|
|
30
|
+
V(UnsettledTopLevelAwait, 13) \
|
|
31
|
+
V(StartupSnapshotFailure, 14) \
|
|
32
|
+
/* If the process exits from unhandled signals e.g. SIGABRT, SIGTRAP, */ \
|
|
33
|
+
/* typically the exit codes are 128 + signal number. We also exit with */ \
|
|
34
|
+
/* certain error codes directly for legacy reasons. Here we define those */ \
|
|
35
|
+
/* that are used to normalize the exit code on Windows. */ \
|
|
36
|
+
V(Abort, 134)
|
|
37
|
+
|
|
38
|
+
// TODO(joyeecheung): expose this to user land when the codes are stable.
|
|
39
|
+
// The underlying type should be an int, or we can get undefined behavior when
|
|
40
|
+
// casting error codes into exit codes (technically we shouldn't do that,
|
|
41
|
+
// but that's how things have been).
|
|
42
|
+
enum class ExitCode : int {
|
|
43
|
+
#define V(Name, Code) k##Name = Code,
|
|
44
|
+
EXIT_CODE_LIST(V)
|
|
45
|
+
#undef V
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
[[noreturn]] void Exit(ExitCode exit_code);
|
|
49
|
+
|
|
50
|
+
} // namespace node
|
|
51
|
+
|
|
52
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
53
|
+
|
|
54
|
+
#endif // SRC_NODE_EXIT_CODE_H_
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#ifndef SRC_NODE_EXTERNAL_REFERENCE_H_
|
|
2
|
+
#define SRC_NODE_EXTERNAL_REFERENCE_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include <cinttypes>
|
|
7
|
+
#include <vector>
|
|
8
|
+
#include "v8-fast-api-calls.h"
|
|
9
|
+
#include "v8.h"
|
|
10
|
+
|
|
11
|
+
namespace node {
|
|
12
|
+
|
|
13
|
+
// This class manages the external references from the V8 heap
|
|
14
|
+
// to the C++ addresses in Node.js.
|
|
15
|
+
class ExternalReferenceRegistry {
|
|
16
|
+
public:
|
|
17
|
+
ExternalReferenceRegistry();
|
|
18
|
+
|
|
19
|
+
#define ALLOWED_EXTERNAL_REFERENCE_TYPES(V) \
|
|
20
|
+
V(v8::FunctionCallback) \
|
|
21
|
+
V(v8::AccessorNameGetterCallback) \
|
|
22
|
+
V(v8::AccessorNameSetterCallback) \
|
|
23
|
+
V(v8::NamedPropertyGetterCallback) \
|
|
24
|
+
V(v8::NamedPropertyDefinerCallback) \
|
|
25
|
+
V(v8::NamedPropertyDeleterCallback) \
|
|
26
|
+
V(v8::NamedPropertyEnumeratorCallback) \
|
|
27
|
+
V(v8::NamedPropertyQueryCallback) \
|
|
28
|
+
V(v8::NamedPropertySetterCallback) \
|
|
29
|
+
V(v8::IndexedPropertyGetterCallbackV2) \
|
|
30
|
+
V(v8::IndexedPropertySetterCallbackV2) \
|
|
31
|
+
V(v8::IndexedPropertyDefinerCallbackV2) \
|
|
32
|
+
V(v8::IndexedPropertyDeleterCallbackV2) \
|
|
33
|
+
V(v8::IndexedPropertyQueryCallbackV2) \
|
|
34
|
+
V(const v8::String::ExternalStringResourceBase*)
|
|
35
|
+
|
|
36
|
+
#define V(ExternalReferenceType) \
|
|
37
|
+
void Register(ExternalReferenceType addr) { RegisterT(addr); }
|
|
38
|
+
ALLOWED_EXTERNAL_REFERENCE_TYPES(V)
|
|
39
|
+
#undef V
|
|
40
|
+
|
|
41
|
+
// Registers both the underlying function pointer
|
|
42
|
+
// and the corresponding CFunctionInfo.
|
|
43
|
+
void Register(const v8::CFunction& c_func) {
|
|
44
|
+
RegisterT(c_func.GetAddress());
|
|
45
|
+
RegisterT(c_func.GetTypeInfo());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// This can be called only once.
|
|
49
|
+
const std::vector<intptr_t>& external_references();
|
|
50
|
+
|
|
51
|
+
bool is_empty() { return external_references_.empty(); }
|
|
52
|
+
|
|
53
|
+
private:
|
|
54
|
+
template <typename T>
|
|
55
|
+
void RegisterT(T* address) {
|
|
56
|
+
external_references_.push_back(reinterpret_cast<intptr_t>(address));
|
|
57
|
+
}
|
|
58
|
+
bool is_finalized_ = false;
|
|
59
|
+
std::vector<intptr_t> external_references_;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \
|
|
63
|
+
V(async_wrap) \
|
|
64
|
+
V(binding) \
|
|
65
|
+
V(blob) \
|
|
66
|
+
V(buffer) \
|
|
67
|
+
V(builtins) \
|
|
68
|
+
V(cares_wrap) \
|
|
69
|
+
V(config) \
|
|
70
|
+
V(contextify) \
|
|
71
|
+
V(credentials) \
|
|
72
|
+
V(encoding_binding) \
|
|
73
|
+
V(env_var) \
|
|
74
|
+
V(errors) \
|
|
75
|
+
V(fs) \
|
|
76
|
+
V(fs_dir) \
|
|
77
|
+
V(fs_event_wrap) \
|
|
78
|
+
V(handle_wrap) \
|
|
79
|
+
V(heap_utils) \
|
|
80
|
+
V(http_parser) \
|
|
81
|
+
V(internal_only_v8) \
|
|
82
|
+
V(messaging) \
|
|
83
|
+
V(mksnapshot) \
|
|
84
|
+
V(module_wrap) \
|
|
85
|
+
V(modules) \
|
|
86
|
+
V(options) \
|
|
87
|
+
V(os) \
|
|
88
|
+
V(performance) \
|
|
89
|
+
V(permission) \
|
|
90
|
+
V(process_methods) \
|
|
91
|
+
V(process_object) \
|
|
92
|
+
V(process_wrap) \
|
|
93
|
+
V(report) \
|
|
94
|
+
V(task_queue) \
|
|
95
|
+
V(tcp_wrap) \
|
|
96
|
+
V(tty_wrap) \
|
|
97
|
+
V(udp_wrap) \
|
|
98
|
+
V(url) \
|
|
99
|
+
V(util) \
|
|
100
|
+
V(pipe_wrap) \
|
|
101
|
+
V(sea) \
|
|
102
|
+
V(serdes) \
|
|
103
|
+
V(string_decoder) \
|
|
104
|
+
V(stream_wrap) \
|
|
105
|
+
V(signal_wrap) \
|
|
106
|
+
V(spawn_sync) \
|
|
107
|
+
V(trace_events) \
|
|
108
|
+
V(timers) \
|
|
109
|
+
V(types) \
|
|
110
|
+
V(uv) \
|
|
111
|
+
V(v8) \
|
|
112
|
+
V(zlib) \
|
|
113
|
+
V(wasm_web_api) \
|
|
114
|
+
V(worker)
|
|
115
|
+
|
|
116
|
+
#if NODE_HAVE_I18N_SUPPORT
|
|
117
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) V(icu)
|
|
118
|
+
#else
|
|
119
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_I18N(V)
|
|
120
|
+
#endif // NODE_HAVE_I18N_SUPPORT
|
|
121
|
+
|
|
122
|
+
#if HAVE_INSPECTOR
|
|
123
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) \
|
|
124
|
+
V(inspector) \
|
|
125
|
+
V(profiler)
|
|
126
|
+
#else
|
|
127
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V)
|
|
128
|
+
#endif // HAVE_INSPECTOR
|
|
129
|
+
|
|
130
|
+
#if HAVE_OPENSSL
|
|
131
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) V(crypto) V(tls_wrap)
|
|
132
|
+
#else
|
|
133
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V)
|
|
134
|
+
#endif // HAVE_OPENSSL
|
|
135
|
+
|
|
136
|
+
#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
|
|
137
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_QUIC(V) V(quic)
|
|
138
|
+
#else
|
|
139
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST_QUIC(V)
|
|
140
|
+
#endif
|
|
141
|
+
|
|
142
|
+
#define EXTERNAL_REFERENCE_BINDING_LIST(V) \
|
|
143
|
+
EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \
|
|
144
|
+
EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) \
|
|
145
|
+
EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) \
|
|
146
|
+
EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) \
|
|
147
|
+
EXTERNAL_REFERENCE_BINDING_LIST_QUIC(V)
|
|
148
|
+
|
|
149
|
+
} // namespace node
|
|
150
|
+
|
|
151
|
+
// Declare all the external reference registration functions here,
|
|
152
|
+
// and define them later with #NODE_BINDING_EXTERNAL_REFERENCE(modname, func);
|
|
153
|
+
#define V(modname) \
|
|
154
|
+
void _register_external_reference_##modname( \
|
|
155
|
+
node::ExternalReferenceRegistry* registry);
|
|
156
|
+
EXTERNAL_REFERENCE_BINDING_LIST(V)
|
|
157
|
+
#undef V
|
|
158
|
+
|
|
159
|
+
#define NODE_BINDING_EXTERNAL_REFERENCE(modname, func) \
|
|
160
|
+
void _register_external_reference_##modname( \
|
|
161
|
+
node::ExternalReferenceRegistry* registry) { \
|
|
162
|
+
func(registry); \
|
|
163
|
+
}
|
|
164
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
165
|
+
#endif // SRC_NODE_EXTERNAL_REFERENCE_H_
|