@kungfu-tech/libnode-win32-x64 22.22.3-kf.0 → 22.22.3-kf.2

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.
Files changed (342) hide show
  1. package/dist/node/include/acorn_version.h +6 -0
  2. package/dist/node/include/aliased_buffer-inl.h +244 -0
  3. package/dist/node/include/aliased_buffer.h +206 -0
  4. package/dist/node/include/aliased_struct-inl.h +54 -0
  5. package/dist/node/include/aliased_struct.h +63 -0
  6. package/dist/node/include/amaro_version.h +6 -0
  7. package/dist/node/include/async_context_frame.h +33 -0
  8. package/dist/node/include/async_wrap-inl.h +96 -0
  9. package/dist/node/include/async_wrap.h +243 -0
  10. package/dist/node/include/base_object-inl.h +335 -0
  11. package/dist/node/include/base_object.h +342 -0
  12. package/dist/node/include/base_object_types.h +74 -0
  13. package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
  14. package/dist/node/include/blob_serializer_deserializer.h +132 -0
  15. package/dist/node/include/callback_queue-inl.h +97 -0
  16. package/dist/node/include/callback_queue.h +79 -0
  17. package/dist/node/include/cares_wrap.h +447 -0
  18. package/dist/node/include/cjs_module_lexer_version.h +6 -0
  19. package/dist/node/include/cleanup_queue-inl.h +36 -0
  20. package/dist/node/include/cleanup_queue.h +79 -0
  21. package/dist/node/include/compile_cache.h +104 -0
  22. package/dist/node/include/connect_wrap.h +26 -0
  23. package/dist/node/include/connection_wrap.h +30 -0
  24. package/dist/node/include/cppgc/allocation.h +310 -0
  25. package/dist/node/include/cppgc/common.h +28 -0
  26. package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
  27. package/dist/node/include/cppgc/custom-space.h +97 -0
  28. package/dist/node/include/cppgc/default-platform.h +67 -0
  29. package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
  30. package/dist/node/include/cppgc/explicit-management.h +100 -0
  31. package/dist/node/include/cppgc/garbage-collected.h +106 -0
  32. package/dist/node/include/cppgc/heap-consistency.h +309 -0
  33. package/dist/node/include/cppgc/heap-handle.h +48 -0
  34. package/dist/node/include/cppgc/heap-state.h +82 -0
  35. package/dist/node/include/cppgc/heap-statistics.h +120 -0
  36. package/dist/node/include/cppgc/heap.h +202 -0
  37. package/dist/node/include/cppgc/internal/api-constants.h +87 -0
  38. package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
  39. package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
  40. package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
  41. package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
  42. package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
  43. package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
  44. package/dist/node/include/cppgc/internal/gc-info.h +148 -0
  45. package/dist/node/include/cppgc/internal/logging.h +50 -0
  46. package/dist/node/include/cppgc/internal/member-storage.h +256 -0
  47. package/dist/node/include/cppgc/internal/name-trait.h +137 -0
  48. package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
  49. package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
  50. package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
  51. package/dist/node/include/cppgc/liveness-broker.h +78 -0
  52. package/dist/node/include/cppgc/macros.h +35 -0
  53. package/dist/node/include/cppgc/member.h +629 -0
  54. package/dist/node/include/cppgc/name-provider.h +65 -0
  55. package/dist/node/include/cppgc/object-size-trait.h +58 -0
  56. package/dist/node/include/cppgc/persistent.h +377 -0
  57. package/dist/node/include/cppgc/platform.h +163 -0
  58. package/dist/node/include/cppgc/prefinalizer.h +75 -0
  59. package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
  60. package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
  61. package/dist/node/include/cppgc/source-location.h +16 -0
  62. package/dist/node/include/cppgc/testing.h +106 -0
  63. package/dist/node/include/cppgc/trace-trait.h +128 -0
  64. package/dist/node/include/cppgc/type-traits.h +271 -0
  65. package/dist/node/include/cppgc/visitor.h +504 -0
  66. package/dist/node/include/crypto/crypto_aes.h +88 -0
  67. package/dist/node/include/crypto/crypto_bio.h +193 -0
  68. package/dist/node/include/crypto/crypto_cipher.h +293 -0
  69. package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
  70. package/dist/node/include/crypto/crypto_clienthello.h +131 -0
  71. package/dist/node/include/crypto/crypto_common.h +64 -0
  72. package/dist/node/include/crypto/crypto_context.h +171 -0
  73. package/dist/node/include/crypto/crypto_dh.h +126 -0
  74. package/dist/node/include/crypto/crypto_dsa.h +52 -0
  75. package/dist/node/include/crypto/crypto_ec.h +164 -0
  76. package/dist/node/include/crypto/crypto_hash.h +91 -0
  77. package/dist/node/include/crypto/crypto_hkdf.h +61 -0
  78. package/dist/node/include/crypto/crypto_hmac.h +92 -0
  79. package/dist/node/include/crypto/crypto_keygen.h +299 -0
  80. package/dist/node/include/crypto/crypto_keys.h +392 -0
  81. package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
  82. package/dist/node/include/crypto/crypto_random.h +124 -0
  83. package/dist/node/include/crypto/crypto_rsa.h +136 -0
  84. package/dist/node/include/crypto/crypto_scrypt.h +85 -0
  85. package/dist/node/include/crypto/crypto_sig.h +165 -0
  86. package/dist/node/include/crypto/crypto_spkac.h +21 -0
  87. package/dist/node/include/crypto/crypto_timing.h +20 -0
  88. package/dist/node/include/crypto/crypto_tls.h +305 -0
  89. package/dist/node/include/crypto/crypto_util.h +725 -0
  90. package/dist/node/include/crypto/crypto_x509.h +140 -0
  91. package/dist/node/include/dataqueue/queue.h +306 -0
  92. package/dist/node/include/debug_utils-inl.h +278 -0
  93. package/dist/node/include/debug_utils.h +196 -0
  94. package/dist/node/include/diagnosticfilename-inl.h +33 -0
  95. package/dist/node/include/embedded_data.h +17 -0
  96. package/dist/node/include/encoding_binding.h +61 -0
  97. package/dist/node/include/env-inl.h +984 -0
  98. package/dist/node/include/env.h +1287 -0
  99. package/dist/node/include/env_properties.h +540 -0
  100. package/dist/node/include/handle_wrap.h +123 -0
  101. package/dist/node/include/histogram-inl.h +107 -0
  102. package/dist/node/include/histogram.h +279 -0
  103. package/dist/node/include/inspector/io_agent.h +30 -0
  104. package/dist/node/include/inspector/main_thread_interface.h +116 -0
  105. package/dist/node/include/inspector/network_agent.h +94 -0
  106. package/dist/node/include/inspector/network_inspector.h +45 -0
  107. package/dist/node/include/inspector/network_requests_buffer.h +195 -0
  108. package/dist/node/include/inspector/network_resource_manager.h +29 -0
  109. package/dist/node/include/inspector/node_json.h +24 -0
  110. package/dist/node/include/inspector/node_string.h +101 -0
  111. package/dist/node/include/inspector/protocol_helper.h +27 -0
  112. package/dist/node/include/inspector/runtime_agent.h +41 -0
  113. package/dist/node/include/inspector/target_agent.h +75 -0
  114. package/dist/node/include/inspector/tracing_agent.h +43 -0
  115. package/dist/node/include/inspector/worker_agent.h +40 -0
  116. package/dist/node/include/inspector/worker_inspector.h +124 -0
  117. package/dist/node/include/inspector_agent.h +165 -0
  118. package/dist/node/include/inspector_io.h +78 -0
  119. package/dist/node/include/inspector_profiler.h +149 -0
  120. package/dist/node/include/inspector_socket.h +60 -0
  121. package/dist/node/include/inspector_socket_server.h +110 -0
  122. package/dist/node/include/js_native_api.h +607 -0
  123. package/dist/node/include/js_native_api_types.h +226 -0
  124. package/dist/node/include/js_native_api_v8.h +485 -0
  125. package/dist/node/include/js_native_api_v8_internals.h +45 -0
  126. package/dist/node/include/js_stream.h +52 -0
  127. package/dist/node/include/json_utils.h +172 -0
  128. package/dist/node/include/large_pages/node_large_page.h +34 -0
  129. package/dist/node/include/libplatform/libplatform-export.h +29 -0
  130. package/dist/node/include/libplatform/libplatform.h +112 -0
  131. package/dist/node/include/libplatform/v8-tracing.h +333 -0
  132. package/dist/node/include/memory_tracker-inl.h +359 -0
  133. package/dist/node/include/memory_tracker.h +289 -0
  134. package/dist/node/include/module_wrap.h +216 -0
  135. package/dist/node/include/node.h +1593 -0
  136. package/dist/node/include/node_api.h +265 -0
  137. package/dist/node/include/node_api_internals.h +48 -0
  138. package/dist/node/include/node_api_types.h +56 -0
  139. package/dist/node/include/node_binding.h +161 -0
  140. package/dist/node/include/node_blob.h +159 -0
  141. package/dist/node/include/node_bob-inl.h +36 -0
  142. package/dist/node/include/node_bob.h +107 -0
  143. package/dist/node/include/node_buffer.h +92 -0
  144. package/dist/node/include/node_builtins.h +220 -0
  145. package/dist/node/include/node_config_file.h +46 -0
  146. package/dist/node/include/node_constants.h +82 -0
  147. package/dist/node/include/node_context_data.h +168 -0
  148. package/dist/node/include/node_contextify.h +204 -0
  149. package/dist/node/include/node_crypto.h +56 -0
  150. package/dist/node/include/node_debug.h +30 -0
  151. package/dist/node/include/node_dir.h +52 -0
  152. package/dist/node/include/node_dotenv.h +45 -0
  153. package/dist/node/include/node_errors.h +380 -0
  154. package/dist/node/include/node_exit_code.h +54 -0
  155. package/dist/node/include/node_external_reference.h +165 -0
  156. package/dist/node/include/node_file-inl.h +406 -0
  157. package/dist/node/include/node_file.h +537 -0
  158. package/dist/node/include/node_http2.h +1177 -0
  159. package/dist/node/include/node_http2_state.h +159 -0
  160. package/dist/node/include/node_http_common-inl.h +202 -0
  161. package/dist/node/include/node_http_common.h +535 -0
  162. package/dist/node/include/node_i18n.h +132 -0
  163. package/dist/node/include/node_internals.h +483 -0
  164. package/dist/node/include/node_main_instance.h +67 -0
  165. package/dist/node/include/node_mem-inl.h +113 -0
  166. package/dist/node/include/node_mem.h +45 -0
  167. package/dist/node/include/node_messaging.h +389 -0
  168. package/dist/node/include/node_metadata.h +164 -0
  169. package/dist/node/include/node_modules.h +91 -0
  170. package/dist/node/include/node_mutex.h +323 -0
  171. package/dist/node/include/node_object_wrap.h +132 -0
  172. package/dist/node/include/node_options-inl.h +490 -0
  173. package/dist/node/include/node_options.h +615 -0
  174. package/dist/node/include/node_perf.h +166 -0
  175. package/dist/node/include/node_perf_common.h +102 -0
  176. package/dist/node/include/node_platform.h +238 -0
  177. package/dist/node/include/node_process-inl.h +26 -0
  178. package/dist/node/include/node_process.h +112 -0
  179. package/dist/node/include/node_realm-inl.h +151 -0
  180. package/dist/node/include/node_realm.h +183 -0
  181. package/dist/node/include/node_report.h +43 -0
  182. package/dist/node/include/node_revert.h +82 -0
  183. package/dist/node/include/node_root_certs.h +3520 -0
  184. package/dist/node/include/node_sea.h +74 -0
  185. package/dist/node/include/node_shadow_realm.h +46 -0
  186. package/dist/node/include/node_snapshot_builder.h +57 -0
  187. package/dist/node/include/node_snapshotable.h +174 -0
  188. package/dist/node/include/node_sockaddr-inl.h +257 -0
  189. package/dist/node/include/node_sockaddr.h +394 -0
  190. package/dist/node/include/node_sqlite.h +270 -0
  191. package/dist/node/include/node_stat_watcher.h +73 -0
  192. package/dist/node/include/node_task_runner.h +92 -0
  193. package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
  194. package/dist/node/include/node_threadsafe_cow.h +105 -0
  195. package/dist/node/include/node_union_bytes.h +81 -0
  196. package/dist/node/include/node_url.h +96 -0
  197. package/dist/node/include/node_v8.h +77 -0
  198. package/dist/node/include/node_v8_platform-inl.h +185 -0
  199. package/dist/node/include/node_version.h +110 -0
  200. package/dist/node/include/node_wasi.h +184 -0
  201. package/dist/node/include/node_wasm_web_api.h +55 -0
  202. package/dist/node/include/node_watchdog.h +154 -0
  203. package/dist/node/include/node_webstorage.h +60 -0
  204. package/dist/node/include/node_worker.h +158 -0
  205. package/dist/node/include/path.h +33 -0
  206. package/dist/node/include/permission/addon_permission.h +31 -0
  207. package/dist/node/include/permission/child_process_permission.h +31 -0
  208. package/dist/node/include/permission/fs_permission.h +167 -0
  209. package/dist/node/include/permission/inspector_permission.h +31 -0
  210. package/dist/node/include/permission/permission.h +138 -0
  211. package/dist/node/include/permission/permission_base.h +65 -0
  212. package/dist/node/include/permission/wasi_permission.h +31 -0
  213. package/dist/node/include/permission/worker_permission.h +31 -0
  214. package/dist/node/include/pipe_wrap.h +80 -0
  215. package/dist/node/include/quic/application.h +159 -0
  216. package/dist/node/include/quic/bindingdata.h +272 -0
  217. package/dist/node/include/quic/cid.h +127 -0
  218. package/dist/node/include/quic/data.h +148 -0
  219. package/dist/node/include/quic/defs.h +245 -0
  220. package/dist/node/include/quic/endpoint.h +458 -0
  221. package/dist/node/include/quic/http3.h +15 -0
  222. package/dist/node/include/quic/logstream.h +81 -0
  223. package/dist/node/include/quic/packet.h +152 -0
  224. package/dist/node/include/quic/preferredaddress.h +72 -0
  225. package/dist/node/include/quic/session.h +443 -0
  226. package/dist/node/include/quic/sessionticket.h +108 -0
  227. package/dist/node/include/quic/streams.h +232 -0
  228. package/dist/node/include/quic/tlscontext.h +227 -0
  229. package/dist/node/include/quic/tokens.h +256 -0
  230. package/dist/node/include/quic/transportparams.h +165 -0
  231. package/dist/node/include/req_wrap-inl.h +171 -0
  232. package/dist/node/include/req_wrap.h +77 -0
  233. package/dist/node/include/spawn_sync.h +243 -0
  234. package/dist/node/include/stream_base-inl.h +173 -0
  235. package/dist/node/include/stream_base.h +478 -0
  236. package/dist/node/include/stream_pipe.h +76 -0
  237. package/dist/node/include/stream_wrap.h +132 -0
  238. package/dist/node/include/string_bytes.h +113 -0
  239. package/dist/node/include/string_decoder-inl.h +31 -0
  240. package/dist/node/include/string_decoder.h +49 -0
  241. package/dist/node/include/tcp_wrap.h +105 -0
  242. package/dist/node/include/threadpoolwork-inl.h +70 -0
  243. package/dist/node/include/timer_wrap-inl.h +32 -0
  244. package/dist/node/include/timer_wrap.h +85 -0
  245. package/dist/node/include/timers.h +70 -0
  246. package/dist/node/include/tracing/agent.h +195 -0
  247. package/dist/node/include/tracing/node_trace_buffer.h +83 -0
  248. package/dist/node/include/tracing/node_trace_writer.h +75 -0
  249. package/dist/node/include/tracing/trace_event.h +722 -0
  250. package/dist/node/include/tracing/trace_event_common.h +1109 -0
  251. package/dist/node/include/tracing/traced_value.h +129 -0
  252. package/dist/node/include/tty_wrap.h +65 -0
  253. package/dist/node/include/udp_wrap.h +230 -0
  254. package/dist/node/include/undici_version.h +6 -0
  255. package/dist/node/include/util-inl.h +700 -0
  256. package/dist/node/include/util.h +1021 -0
  257. package/dist/node/include/uv/aix.h +32 -0
  258. package/dist/node/include/uv/bsd.h +34 -0
  259. package/dist/node/include/uv/darwin.h +61 -0
  260. package/dist/node/include/uv/errno.h +483 -0
  261. package/dist/node/include/uv/linux.h +34 -0
  262. package/dist/node/include/uv/os390.h +33 -0
  263. package/dist/node/include/uv/posix.h +31 -0
  264. package/dist/node/include/uv/sunos.h +44 -0
  265. package/dist/node/include/uv/threadpool.h +37 -0
  266. package/dist/node/include/uv/tree.h +521 -0
  267. package/dist/node/include/uv/unix.h +512 -0
  268. package/dist/node/include/uv/version.h +43 -0
  269. package/dist/node/include/uv/win.h +698 -0
  270. package/dist/node/include/uv.h +1990 -0
  271. package/dist/node/include/v8-array-buffer.h +525 -0
  272. package/dist/node/include/v8-callbacks.h +462 -0
  273. package/dist/node/include/v8-container.h +183 -0
  274. package/dist/node/include/v8-context.h +485 -0
  275. package/dist/node/include/v8-cppgc.h +245 -0
  276. package/dist/node/include/v8-data.h +80 -0
  277. package/dist/node/include/v8-date.h +48 -0
  278. package/dist/node/include/v8-debug.h +168 -0
  279. package/dist/node/include/v8-embedder-heap.h +82 -0
  280. package/dist/node/include/v8-embedder-state-scope.h +52 -0
  281. package/dist/node/include/v8-exception.h +223 -0
  282. package/dist/node/include/v8-extension.h +62 -0
  283. package/dist/node/include/v8-external.h +37 -0
  284. package/dist/node/include/v8-fast-api-calls.h +984 -0
  285. package/dist/node/include/v8-forward.h +82 -0
  286. package/dist/node/include/v8-function-callback.h +607 -0
  287. package/dist/node/include/v8-function.h +140 -0
  288. package/dist/node/include/v8-handle-base.h +137 -0
  289. package/dist/node/include/v8-initialization.h +289 -0
  290. package/dist/node/include/v8-inspector-protocol.h +13 -0
  291. package/dist/node/include/v8-inspector.h +419 -0
  292. package/dist/node/include/v8-internal.h +1397 -0
  293. package/dist/node/include/v8-isolate.h +1767 -0
  294. package/dist/node/include/v8-json.h +47 -0
  295. package/dist/node/include/v8-local-handle.h +758 -0
  296. package/dist/node/include/v8-locker.h +138 -0
  297. package/dist/node/include/v8-maybe.h +160 -0
  298. package/dist/node/include/v8-memory-span.h +198 -0
  299. package/dist/node/include/v8-message.h +233 -0
  300. package/dist/node/include/v8-metrics.h +264 -0
  301. package/dist/node/include/v8-microtask-queue.h +157 -0
  302. package/dist/node/include/v8-microtask.h +28 -0
  303. package/dist/node/include/v8-object.h +824 -0
  304. package/dist/node/include/v8-persistent-handle.h +582 -0
  305. package/dist/node/include/v8-platform.h +1358 -0
  306. package/dist/node/include/v8-primitive-object.h +118 -0
  307. package/dist/node/include/v8-primitive.h +877 -0
  308. package/dist/node/include/v8-profiler.h +1302 -0
  309. package/dist/node/include/v8-promise.h +174 -0
  310. package/dist/node/include/v8-proxy.h +50 -0
  311. package/dist/node/include/v8-regexp.h +106 -0
  312. package/dist/node/include/v8-script.h +904 -0
  313. package/dist/node/include/v8-snapshot.h +266 -0
  314. package/dist/node/include/v8-source-location.h +92 -0
  315. package/dist/node/include/v8-statistics.h +238 -0
  316. package/dist/node/include/v8-template.h +1297 -0
  317. package/dist/node/include/v8-traced-handle.h +432 -0
  318. package/dist/node/include/v8-typed-array.h +390 -0
  319. package/dist/node/include/v8-unwinder-state.h +31 -0
  320. package/dist/node/include/v8-unwinder.h +132 -0
  321. package/dist/node/include/v8-util.h +665 -0
  322. package/dist/node/include/v8-value-serializer-version.h +24 -0
  323. package/dist/node/include/v8-value-serializer.h +316 -0
  324. package/dist/node/include/v8-value.h +655 -0
  325. package/dist/node/include/v8-version-string.h +38 -0
  326. package/dist/node/include/v8-version.h +20 -0
  327. package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
  328. package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
  329. package/dist/node/include/v8-wasm.h +201 -0
  330. package/dist/node/include/v8-weak-callback-info.h +80 -0
  331. package/dist/node/include/v8.h +88 -0
  332. package/dist/node/include/v8config.h +981 -0
  333. package/dist/node/include/zlib_version.h +6 -0
  334. package/dist/node/libnode.dll +0 -0
  335. package/dist/node/libnode.lib +0 -0
  336. package/dist/node/libnodebuildinfo.json +10 -0
  337. package/dist/node/link_node.lib +0 -0
  338. package/dist/node/link_node.node +0 -0
  339. package/ensure-libnode-aliases.js +41 -0
  340. package/index.js +2 -0
  341. package/libnode.release.json +2 -2
  342. package/package.json +2 -1
@@ -0,0 +1,485 @@
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_CONTEXT_H_
6
+ #define INCLUDE_V8_CONTEXT_H_
7
+
8
+ #include <stdint.h>
9
+
10
+ #include <vector>
11
+
12
+ #include "v8-data.h" // NOLINT(build/include_directory)
13
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
14
+ #include "v8-maybe.h" // NOLINT(build/include_directory)
15
+ #include "v8-snapshot.h" // NOLINT(build/include_directory)
16
+ #include "v8config.h" // NOLINT(build/include_directory)
17
+
18
+ namespace v8 {
19
+
20
+ class Function;
21
+ class MicrotaskQueue;
22
+ class Object;
23
+ class ObjectTemplate;
24
+ class Value;
25
+ class String;
26
+
27
+ /**
28
+ * A container for extension names.
29
+ */
30
+ class V8_EXPORT ExtensionConfiguration {
31
+ public:
32
+ ExtensionConfiguration() : name_count_(0), names_(nullptr) {}
33
+ ExtensionConfiguration(int name_count, const char* names[])
34
+ : name_count_(name_count), names_(names) {}
35
+
36
+ const char** begin() const { return &names_[0]; }
37
+ const char** end() const { return &names_[name_count_]; }
38
+
39
+ private:
40
+ const int name_count_;
41
+ const char** names_;
42
+ };
43
+
44
+ /**
45
+ * A sandboxed execution context with its own set of built-in objects
46
+ * and functions.
47
+ */
48
+ class V8_EXPORT Context : public Data {
49
+ public:
50
+ /**
51
+ * Returns the global proxy object.
52
+ *
53
+ * Global proxy object is a thin wrapper whose prototype points to actual
54
+ * context's global object with the properties like Object, etc. This is done
55
+ * that way for security reasons (for more details see
56
+ * https://wiki.mozilla.org/Gecko:SplitWindow).
57
+ *
58
+ * Please note that changes to global proxy object prototype most probably
59
+ * would break VM---v8 expects only global object as a prototype of global
60
+ * proxy object.
61
+ */
62
+ Local<Object> Global();
63
+
64
+ /**
65
+ * Detaches the global object from its context before
66
+ * the global object can be reused to create a new context.
67
+ */
68
+ void DetachGlobal();
69
+
70
+ /**
71
+ * Creates a new context and returns a handle to the newly allocated
72
+ * context.
73
+ *
74
+ * \param isolate The isolate in which to create the context.
75
+ *
76
+ * \param extensions An optional extension configuration containing
77
+ * the extensions to be installed in the newly created context.
78
+ *
79
+ * \param global_template An optional object template from which the
80
+ * global object for the newly created context will be created.
81
+ *
82
+ * \param global_object An optional global object to be reused for
83
+ * the newly created context. This global object must have been
84
+ * created by a previous call to Context::New with the same global
85
+ * template. The state of the global object will be completely reset
86
+ * and only object identify will remain.
87
+ *
88
+ * \param internal_fields_deserializer An optional callback used
89
+ * to deserialize fields set by
90
+ * v8::Object::SetAlignedPointerInInternalField() in wrapper objects
91
+ * from the default context snapshot. It should match the
92
+ * SerializeInternalFieldsCallback() used by
93
+ * v8::SnapshotCreator::SetDefaultContext() when the default context
94
+ * snapshot is created. It does not need to be configured if the default
95
+ * context snapshot contains no wrapper objects with pointer internal
96
+ * fields, or if no custom startup snapshot is configured
97
+ * in the v8::CreateParams used to create the isolate.
98
+ *
99
+ * \param microtask_queue An optional microtask queue used to manage
100
+ * the microtasks created in this context. If not set the per-isolate
101
+ * default microtask queue would be used.
102
+ *
103
+ * \param context_data_deserializer An optional callback used
104
+ * to deserialize embedder data set by
105
+ * v8::Context::SetAlignedPointerInEmbedderData() in the default
106
+ * context from the default context snapshot. It does not need to be
107
+ * configured if the default context snapshot contains no pointer embedder
108
+ * data, or if no custom startup snapshot is configured in the
109
+ * v8::CreateParams used to create the isolate.
110
+ */
111
+ static Local<Context> New(
112
+ Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
113
+ MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
114
+ MaybeLocal<Value> global_object = MaybeLocal<Value>(),
115
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
116
+ DeserializeInternalFieldsCallback(),
117
+ MicrotaskQueue* microtask_queue = nullptr,
118
+ DeserializeContextDataCallback context_data_deserializer =
119
+ DeserializeContextDataCallback());
120
+
121
+ /**
122
+ * Create a new context from a (non-default) context snapshot. There
123
+ * is no way to provide a global object template since we do not create
124
+ * a new global object from template, but we can reuse a global object.
125
+ *
126
+ * \param isolate See v8::Context::New.
127
+ *
128
+ * \param context_snapshot_index The index of the context snapshot to
129
+ * deserialize from. Use v8::Context::New for the default snapshot.
130
+ *
131
+ * \param internal_fields_deserializer An optional callback used
132
+ * to deserialize fields set by
133
+ * v8::Object::SetAlignedPointerInInternalField() in wrapper objects
134
+ * from the default context snapshot. It does not need to be
135
+ * configured if there are no wrapper objects with no internal
136
+ * pointer fields in the default context snapshot or if no startup
137
+ * snapshot is configured when the isolate is created.
138
+ *
139
+ * \param extensions See v8::Context::New.
140
+ *
141
+ * \param global_object See v8::Context::New.
142
+ *
143
+ * \param internal_fields_deserializer Similar to
144
+ * internal_fields_deserializer in v8::Context::New but applies to
145
+ * the context specified by the context_snapshot_index.
146
+ *
147
+ * \param microtask_queue See v8::Context::New.
148
+ *
149
+ * \param context_data_deserializer Similar to
150
+ * context_data_deserializer in v8::Context::New but applies to
151
+ * the context specified by the context_snapshot_index.
152
+ */
153
+ static MaybeLocal<Context> FromSnapshot(
154
+ Isolate* isolate, size_t context_snapshot_index,
155
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
156
+ DeserializeInternalFieldsCallback(),
157
+ ExtensionConfiguration* extensions = nullptr,
158
+ MaybeLocal<Value> global_object = MaybeLocal<Value>(),
159
+ MicrotaskQueue* microtask_queue = nullptr,
160
+ DeserializeContextDataCallback context_data_deserializer =
161
+ DeserializeContextDataCallback());
162
+
163
+ /**
164
+ * Returns an global object that isn't backed by an actual context.
165
+ *
166
+ * The global template needs to have access checks with handlers installed.
167
+ * If an existing global object is passed in, the global object is detached
168
+ * from its context.
169
+ *
170
+ * Note that this is different from a detached context where all accesses to
171
+ * the global proxy will fail. Instead, the access check handlers are invoked.
172
+ *
173
+ * It is also not possible to detach an object returned by this method.
174
+ * Instead, the access check handlers need to return nothing to achieve the
175
+ * same effect.
176
+ *
177
+ * It is possible, however, to create a new context from the global object
178
+ * returned by this method.
179
+ */
180
+ static MaybeLocal<Object> NewRemoteContext(
181
+ Isolate* isolate, Local<ObjectTemplate> global_template,
182
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
183
+
184
+ /**
185
+ * Sets the security token for the context. To access an object in
186
+ * another context, the security tokens must match.
187
+ */
188
+ void SetSecurityToken(Local<Value> token);
189
+
190
+ /** Restores the security token to the default value. */
191
+ void UseDefaultSecurityToken();
192
+
193
+ /** Returns the security token of this context.*/
194
+ Local<Value> GetSecurityToken();
195
+
196
+ /**
197
+ * Enter this context. After entering a context, all code compiled
198
+ * and run is compiled and run in this context. If another context
199
+ * is already entered, this old context is saved so it can be
200
+ * restored when the new context is exited.
201
+ */
202
+ void Enter();
203
+
204
+ /**
205
+ * Exit this context. Exiting the current context restores the
206
+ * context that was in place when entering the current context.
207
+ */
208
+ void Exit();
209
+
210
+ /**
211
+ * Delegate to help with Deep freezing embedder-specific objects (such as
212
+ * JSApiObjects) that can not be frozen natively.
213
+ */
214
+ class DeepFreezeDelegate {
215
+ public:
216
+ /**
217
+ * Performs embedder-specific operations to freeze the provided embedder
218
+ * object. The provided object *will* be frozen by DeepFreeze after this
219
+ * function returns, so only embedder-specific objects need to be frozen.
220
+ * This function *may not* create new JS objects or perform JS allocations.
221
+ * Any v8 objects reachable from the provided embedder object that should
222
+ * also be considered for freezing should be added to the children_out
223
+ * parameter. Returns true if the operation completed successfully.
224
+ */
225
+ virtual bool FreezeEmbedderObjectAndGetChildren(
226
+ Local<Object> obj, LocalVector<Object>& children_out) = 0;
227
+ };
228
+
229
+ /**
230
+ * Attempts to recursively freeze all objects reachable from this context.
231
+ * Some objects (generators, iterators, non-const closures) can not be frozen
232
+ * and will cause this method to throw an error. An optional delegate can be
233
+ * provided to help freeze embedder-specific objects.
234
+ *
235
+ * Freezing occurs in two steps:
236
+ * 1. "Marking" where we iterate through all objects reachable by this
237
+ * context, accumulating a list of objects that need to be frozen and
238
+ * looking for objects that can't be frozen. This step is separated because
239
+ * it is more efficient when we can assume there is no garbage collection.
240
+ * 2. "Freezing" where we go through the list of objects and freezing them.
241
+ * This effectively requires copying them so it may trigger garbage
242
+ * collection.
243
+ */
244
+ Maybe<void> DeepFreeze(DeepFreezeDelegate* delegate = nullptr);
245
+
246
+ /** Returns the isolate associated with a current context. */
247
+ Isolate* GetIsolate();
248
+
249
+ /** Returns the microtask queue associated with a current context. */
250
+ MicrotaskQueue* GetMicrotaskQueue();
251
+
252
+ /** Sets the microtask queue associated with the current context. */
253
+ void SetMicrotaskQueue(MicrotaskQueue* queue);
254
+
255
+ /**
256
+ * The field at kDebugIdIndex used to be reserved for the inspector.
257
+ * It now serves no purpose.
258
+ */
259
+ enum EmbedderDataFields { kDebugIdIndex = 0 };
260
+
261
+ /**
262
+ * Return the number of fields allocated for embedder data.
263
+ */
264
+ uint32_t GetNumberOfEmbedderDataFields();
265
+
266
+ /**
267
+ * Gets the embedder data with the given index, which must have been set by a
268
+ * previous call to SetEmbedderData with the same index.
269
+ */
270
+ V8_INLINE Local<Value> GetEmbedderData(int index);
271
+
272
+ /**
273
+ * Gets the binding object used by V8 extras. Extra natives get a reference
274
+ * to this object and can use it to "export" functionality by adding
275
+ * properties. Extra natives can also "import" functionality by accessing
276
+ * properties added by the embedder using the V8 API.
277
+ */
278
+ Local<Object> GetExtrasBindingObject();
279
+
280
+ /**
281
+ * Sets the embedder data with the given index, growing the data as
282
+ * needed. Note that index 0 currently has a special meaning for Chrome's
283
+ * debugger.
284
+ */
285
+ void SetEmbedderData(int index, Local<Value> value);
286
+
287
+ /**
288
+ * Gets a 2-byte-aligned native pointer from the embedder data with the given
289
+ * index, which must have been set by a previous call to
290
+ * SetAlignedPointerInEmbedderData with the same index. Note that index 0
291
+ * currently has a special meaning for Chrome's debugger.
292
+ */
293
+ V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
294
+
295
+ /**
296
+ * Sets a 2-byte-aligned native pointer in the embedder data with the given
297
+ * index, growing the data as needed. Note that index 0 currently has a
298
+ * special meaning for Chrome's debugger.
299
+ */
300
+ void SetAlignedPointerInEmbedderData(int index, void* value);
301
+
302
+ /**
303
+ * Control whether code generation from strings is allowed. Calling
304
+ * this method with false will disable 'eval' and the 'Function'
305
+ * constructor for code running in this context. If 'eval' or the
306
+ * 'Function' constructor are used an exception will be thrown.
307
+ *
308
+ * If code generation from strings is not allowed the
309
+ * V8::AllowCodeGenerationFromStrings callback will be invoked if
310
+ * set before blocking the call to 'eval' or the 'Function'
311
+ * constructor. If that callback returns true, the call will be
312
+ * allowed, otherwise an exception will be thrown. If no callback is
313
+ * set an exception will be thrown.
314
+ */
315
+ void AllowCodeGenerationFromStrings(bool allow);
316
+
317
+ /**
318
+ * Returns true if code generation from strings is allowed for the context.
319
+ * For more details see AllowCodeGenerationFromStrings(bool) documentation.
320
+ */
321
+ bool IsCodeGenerationFromStringsAllowed() const;
322
+
323
+ /**
324
+ * Sets the error description for the exception that is thrown when
325
+ * code generation from strings is not allowed and 'eval' or the 'Function'
326
+ * constructor are called.
327
+ */
328
+ void SetErrorMessageForCodeGenerationFromStrings(Local<String> message);
329
+
330
+ /**
331
+ * Sets the error description for the exception that is thrown when
332
+ * wasm code generation is not allowed.
333
+ */
334
+ void SetErrorMessageForWasmCodeGeneration(Local<String> message);
335
+
336
+ /**
337
+ * Return data that was previously attached to the context snapshot via
338
+ * SnapshotCreator, and removes the reference to it.
339
+ * Repeated call with the same index returns an empty MaybeLocal.
340
+ */
341
+ template <class T>
342
+ V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
343
+
344
+ /**
345
+ * If callback is set, abort any attempt to execute JavaScript in this
346
+ * context, call the specified callback, and throw an exception.
347
+ * To unset abort, pass nullptr as callback.
348
+ */
349
+ using AbortScriptExecutionCallback = void (*)(Isolate* isolate,
350
+ Local<Context> context);
351
+ void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
352
+
353
+ /**
354
+ * Set or clear hooks to be invoked for promise lifecycle operations.
355
+ * To clear a hook, set it to an empty v8::Function. Each function will
356
+ * receive the observed promise as the first argument. If a chaining
357
+ * operation is used on a promise, the init will additionally receive
358
+ * the parent promise as the second argument.
359
+ */
360
+ void SetPromiseHooks(Local<Function> init_hook, Local<Function> before_hook,
361
+ Local<Function> after_hook,
362
+ Local<Function> resolve_hook);
363
+
364
+ bool HasTemplateLiteralObject(Local<Value> object);
365
+ /**
366
+ * Stack-allocated class which sets the execution context for all
367
+ * operations executed within a local scope.
368
+ */
369
+ class V8_NODISCARD Scope {
370
+ public:
371
+ explicit V8_INLINE Scope(Local<Context> context) : context_(context) {
372
+ context_->Enter();
373
+ }
374
+ V8_INLINE ~Scope() { context_->Exit(); }
375
+
376
+ private:
377
+ Local<Context> context_;
378
+ };
379
+
380
+ /**
381
+ * Stack-allocated class to support the backup incumbent settings object
382
+ * stack.
383
+ * https://html.spec.whatwg.org/multipage/webappapis.html#backup-incumbent-settings-object-stack
384
+ */
385
+ class V8_EXPORT V8_NODISCARD BackupIncumbentScope final {
386
+ public:
387
+ /**
388
+ * |backup_incumbent_context| is pushed onto the backup incumbent settings
389
+ * object stack.
390
+ */
391
+ explicit BackupIncumbentScope(Local<Context> backup_incumbent_context);
392
+ ~BackupIncumbentScope();
393
+
394
+ private:
395
+ friend class internal::Isolate;
396
+
397
+ uintptr_t JSStackComparableAddressPrivate() const {
398
+ return js_stack_comparable_address_;
399
+ }
400
+
401
+ Local<Context> backup_incumbent_context_;
402
+ uintptr_t js_stack_comparable_address_ = 0;
403
+ const BackupIncumbentScope* prev_ = nullptr;
404
+ };
405
+
406
+ V8_INLINE static Context* Cast(Data* data);
407
+
408
+ private:
409
+ friend class Value;
410
+ friend class Script;
411
+ friend class Object;
412
+ friend class Function;
413
+
414
+ static void CheckCast(Data* obj);
415
+
416
+ internal::Address* GetDataFromSnapshotOnce(size_t index);
417
+ Local<Value> SlowGetEmbedderData(int index);
418
+ void* SlowGetAlignedPointerFromEmbedderData(int index);
419
+ };
420
+
421
+ // --- Implementation ---
422
+
423
+ Local<Value> Context::GetEmbedderData(int index) {
424
+ #ifndef V8_ENABLE_CHECKS
425
+ using A = internal::Address;
426
+ using I = internal::Internals;
427
+ A ctx = internal::ValueHelper::ValueAsAddress(this);
428
+ A embedder_data =
429
+ I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
430
+ int value_offset =
431
+ I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
432
+ A value = I::ReadRawField<A>(embedder_data, value_offset);
433
+ #ifdef V8_COMPRESS_POINTERS
434
+ // We read the full pointer value and then decompress it in order to avoid
435
+ // dealing with potential endiannes issues.
436
+ value = I::DecompressTaggedField(embedder_data, static_cast<uint32_t>(value));
437
+ #endif
438
+
439
+ auto isolate = reinterpret_cast<v8::Isolate*>(
440
+ internal::IsolateFromNeverReadOnlySpaceObject(ctx));
441
+ return Local<Value>::New(isolate, value);
442
+ #else
443
+ return SlowGetEmbedderData(index);
444
+ #endif
445
+ }
446
+
447
+ void* Context::GetAlignedPointerFromEmbedderData(int index) {
448
+ #if !defined(V8_ENABLE_CHECKS)
449
+ using A = internal::Address;
450
+ using I = internal::Internals;
451
+ A ctx = internal::ValueHelper::ValueAsAddress(this);
452
+ A embedder_data =
453
+ I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
454
+ int value_offset = I::kEmbedderDataArrayHeaderSize +
455
+ (I::kEmbedderDataSlotSize * index) +
456
+ I::kEmbedderDataSlotExternalPointerOffset;
457
+ Isolate* isolate = I::GetIsolateForSandbox(ctx);
458
+ return reinterpret_cast<void*>(
459
+ I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
460
+ isolate, embedder_data, value_offset));
461
+ #else
462
+ return SlowGetAlignedPointerFromEmbedderData(index);
463
+ #endif
464
+ }
465
+
466
+ template <class T>
467
+ MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
468
+ if (auto slot = GetDataFromSnapshotOnce(index); slot) {
469
+ internal::PerformCastCheck(
470
+ internal::ValueHelper::SlotAsValue<T, false>(slot));
471
+ return Local<T>::FromSlot(slot);
472
+ }
473
+ return {};
474
+ }
475
+
476
+ Context* Context::Cast(v8::Data* data) {
477
+ #ifdef V8_ENABLE_CHECKS
478
+ CheckCast(data);
479
+ #endif
480
+ return static_cast<Context*>(data);
481
+ }
482
+
483
+ } // namespace v8
484
+
485
+ #endif // INCLUDE_V8_CONTEXT_H_