Commit Graph
10165 Commits
Author SHA1 Message Date
Michaël Zasso e3a3733e1f src: stop using deprecated v8::Context::GetIsolate
Refs: https://github.com/nodejs/node/commit/5623194a6b16192084d2753a80c350c4ae3dec24
PR-URL: https://github.com/nodejs/node/pull/60223
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2025-10-14 06:46:20 +00:00
Anna Henningsen 3ac88a7a66 src: use string_view in WriteReport()
Since 075936b413, `TriggerNodeReport()` takes `std::string_view`
arguments directly.

PR-URL: https://github.com/nodejs/node/pull/60201
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2025-10-12 15:42:54 +00:00
Chengzhong Wu 1986ee4b65 vm: hint module identifier in instantiate errors
PR-URL: https://github.com/nodejs/node/pull/60199
Fixes: https://github.com/nodejs/node/issues/60157
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-10-12 14:28:56 +00:00
theanarkh f9fcc746f3 v8: add cpu profile
PR-URL: https://github.com/nodejs/node/pull/59807
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-10-11 17:20:57 +00:00
James M Snell a1244f04de src: make additional cleanups in node locks impl
* Track memory held by the Lock instance
* Clean up some Utf8/TwoByteString handling

PR-URL: https://github.com/nodejs/node/pull/60061
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-10-11 15:11:31 +00:00
James M Snell fdb6e66227 src: update locks to use DictionaryTemplate
...and other minor cleanups

PR-URL: https://github.com/nodejs/node/pull/60061
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-10-11 15:11:31 +00:00
Michaël Zasso 367bcce6a6 src: fix usage of deprecated V8 API
Namely `GetContinuationPreservedEmbedderData` and
`SetContinuationPreservedEmbedderData` for their "V2" variants.

Refs: https://github.com/v8/v8/commit/da41db36ec78d7c1f37fc7d0c7a7c580fda970fe
PR-URL: https://github.com/nodejs/node/pull/60174
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2025-10-11 07:57:15 +00:00
Rahul b13f24c2da build, src: fix include paths for vtune files
PR-URL: https://github.com/nodejs/node/pull/59999
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-10-07 19:04:32 +00:00
James M Snell 23fa18444f src: fix small compile warning in quic/streams.cc
Fixes: https://github.com/nodejs/node/issues/60110
PR-URL: https://github.com/nodejs/node/pull/60118
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2025-10-06 13:37:17 +00:00
James M Snell 4a7fbb64e6 src: update contextify to use DictionaryTemplate
PR-URL: https://github.com/nodejs/node/pull/60059
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2025-10-06 09:26:25 +00:00
iknoom 81b71190c6 src: remove AnalyzeTemporaryDtors option from .clang-tidy
PR-URL: https://github.com/nodejs/node/pull/60008
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-10-06 11:12:43 +02:00
James M Snell ed94bc48f3 src: update crypto.getCipherInfo() to use DictionaryTemplate
Also, have it use a null prototype

PR-URL: https://github.com/nodejs/node/pull/60036
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2025-10-05 14:05:35 +00:00
James M Snell e6cd8a21e7 src: update cares_wrap to use DictionaryTemplates
PR-URL: https://github.com/nodejs/node/pull/60033
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-10-04 19:54:21 +00:00
James M Snell 2869c1255b src: correct the error handling in StatementExecutionHelper
Error handling logic was flawed in StatementExecutionHelper
methods.

PR-URL: https://github.com/nodejs/node/pull/60040
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
2025-10-04 12:51:20 -07:00
Michaël Zasso 5623194a6b doc,src,test: replace use of deprecated GetIsolate
`Isolate::GetCurrent()` should be used instead as it returns the same
thing.

Refs: https://github.com/v8/v8/commit/5c4a937aafff2ca21257387510101737afbf10ab
PR-URL: https://github.com/nodejs/node/pull/59805
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-04 18:48:35 +02:00
Andreas Haas 37a3df3556 src: fix calls to v8::Object::wrap
PR-URL: https://github.com/nodejs/node/pull/59805
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-04 18:48:29 +02:00
Michaël Zasso 801ae26fa3 src: update NODE_MODULE_VERSION to 141
Major V8 updates are usually API/ABI incompatible with previous
versions. This commit adapts NODE_MODULE_VERSION for V8 14.1.

Refs: https://github.com/nodejs/CTC/blob/master/meetings/2016-09-28.md
PR-URL: https://github.com/nodejs/node/pull/59805
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-04 18:47:25 +02:00
James M Snell 10df38a38b src: improve performance of dotenv ToObject
Improves the performance of the dotenv parser
ToObject method. Also, switch to a null prototype
object to avoid potential prototype pollution
issues.

PR-URL: https://github.com/nodejs/node/pull/60038
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-10-04 12:54:47 +00:00
Moonki Choi 36b1cc2fcf src: remove unused variables from report
PR-URL: https://github.com/nodejs/node/pull/60047
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-10-02 22:31:09 +00:00
Guy Bedford 23b834058c wasm: revert enable JSPI as already enabled
PR-URL: https://github.com/nodejs/node/pull/60014
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-10-01 16:45:53 -07:00
Guilherme Araújo b217051d36 sqlite: create authorization api
PR-URL: https://github.com/nodejs/node/pull/59928
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
2025-10-01 11:40:45 +02:00
Anna Henningsen 4a9a022dd4 src: avoid unnecessary string allocations in SPrintF impl
If we can use a `std::string_view` instead of a `std::string`, let's
just do that instead.

PR-URL: https://github.com/nodejs/node/pull/60052
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-10-01 00:42:52 +02:00
Anna Henningsen 76e18200d8 src: make ToLower/ToUpper input args more flexible
In particular, this enables passing `std::string_view` instead.

PR-URL: https://github.com/nodejs/node/pull/60052
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-10-01 00:42:51 +02:00
Anna Henningsen 3b0b6b9b94 src: allow std::string_view arguments to SPrintF() and friends
Modernize the code so there is no need to work with raw C strings
anymore.

PR-URL: https://github.com/nodejs/node/pull/60058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-30 15:39:39 +02:00
Anna Henningsen 2e2f4cd095 src: remove unnecessary std::string error messages
If we can just use the classic `THROW_...()` methods directly,
without needing to allocate an `std::string` for the message/format
parameter, let's just do so.

PR-URL: https://github.com/nodejs/node/pull/60057
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-30 15:39:00 +02:00
Anna Henningsen 0cc1304489 src: remove unnecessary shadowed functions on Utf8Value & BufferValue
Both of these are already implemented on the superclass.

PR-URL: https://github.com/nodejs/node/pull/60056
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-30 15:38:17 +02:00
Anna Henningsen 77cf2efa57 src: avoid unnecessary string -> char* -> string round trips
In these places we can just generate `std::string` directly, so
there's no need to convert to an intermediate C string.

PR-URL: https://github.com/nodejs/node/pull/60055
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-30 15:37:42 +02:00
Anna Henningsen e4e859efc3 src: remove useless dereferencing in THROW_...
Our `THROW_...` helpers can handle strings or string views just fine,
all this does is add an extra `strlen()` call that can and should
be avoided.

PR-URL: https://github.com/nodejs/node/pull/60054
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-09-30 15:36:58 +02:00
Anna Henningsen 5d1adb8053 src: bring permissions macros in line with general C/C++ standards
Specifically, avoid the hazard of unintentionally evaluating
an argument multiple times during macro expansion, and do not
assume the available of particular namespaces in the current scope.

PR-URL: https://github.com/nodejs/node/pull/60053
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-09-30 15:36:12 +02:00
pmarchini 3c36ad0b7c deps: update amaro to 1.1.4
PR-URL: https://github.com/nodejs/node/pull/60044
Fixes: https://github.com/nodejs/node/issues/60007
Fixes: https://github.com/nodejs/node/issues/59737
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-09-30 15:34:34 +02:00
Edy Silva 413693481f sqlite: replace ToLocalChecked and improve filter error handling
PR-URL: https://github.com/nodejs/node/pull/60028
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-09-30 15:30:25 +02:00
iknoom 075936b413 src: use std::string_view from node_report
PR-URL: https://github.com/nodejs/node/pull/60006
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-09-30 15:25:55 +02:00
iknoom c6316f9db9 src: fill options_args, options_env after vectors are finalized
PR-URL: https://github.com/nodejs/node/pull/59945
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-28 10:56:50 +00:00
iknoom 3e1adceca4 src: use RAII for uv_process_options_t
PR-URL: https://github.com/nodejs/node/pull/59945
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-28 10:56:50 +00:00
Daniel M Brasil 3312e4e946 src: unflag --experimental-webstorage by default
PR-URL: https://github.com/nodejs/node/pull/57666
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-09-25 11:59:58 +00:00
René e4e86ea3ef typings: update 'types' binding
- Adds:
  - isGeneratorObject
  - isProxy
  - isSharedArrayBuffer
  - isSymbolObject
- Removes:
  - isTypedArray
- Fixes:
  - isDate
  - isNativeError
  - isRegExp
- Improves:
  - isArgumentsObject
  - isExternal

PR-URL: https://github.com/nodejs/node/pull/59692
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-09-24 14:11:47 +00:00
Renegade334 8ca5fec567 timers: fix binding fast call signatures
PR-URL: https://github.com/nodejs/node/pull/59600
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-24 14:11:36 +00:00
Renegade334 4f4d5b348c wasi: fix WasiFunction fast call signature
PR-URL: https://github.com/nodejs/node/pull/59600
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-24 14:11:36 +00:00
Renegade334 5ac6ee7716 process: fix hrtime fast call signatures
PR-URL: https://github.com/nodejs/node/pull/59600
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-24 14:11:35 +00:00
Renegade334 e9a0912848 perf_hooks: fix histogram fast call signatures
PR-URL: https://github.com/nodejs/node/pull/59600
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-24 14:11:35 +00:00
Anna Henningsen 9692677afe src: simplify watchdog instantiations via std::optional
It's been a bit of a code smell that we create these objects in
different conditional branches, effectively forcing ourselves to
duplicate logic between those branches.

This code predates `std::optional` being available to us, but
now that it is, it's the idiomatic way to resolve this issue.

(This commit also explicitly deletes move and copy members for
these classes; these had previously been omitted for brevity,
but adding them made me feel more confident that there is no
hidden copy operation added through this change.)

PR-URL: https://github.com/nodejs/node/pull/59960
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-23 23:29:19 +00:00
Bart Louwers d2ff9daf58 sqlite: fix crash session extension callbacks with workers
PR-URL: https://github.com/nodejs/node/pull/59848
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
2025-09-23 14:41:39 +00:00
theanarkh 24ded11b66 worker: add heap profile API
PR-URL: https://github.com/nodejs/node/pull/59846
Refs: https://github.com/nodejs/node/pull/59428
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-09-23 12:41:47 +00:00
Guy Bedford 4396cf2d45 wasm: enable JSPI
PR-URL: https://github.com/nodejs/node/pull/59941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-09-22 18:12:43 -07:00
jhofstee 54c456702c zlib: reduce code duplication
The offset in the allocated memory was calculated in alloc and free,
this makes it a single constant so it only needs to be defined once.

PR-URL: https://github.com/nodejs/node/pull/57810
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-22 20:53:01 +00:00
James M Snell 327e175ba0 src: update crypto objects to use DictionaryTemplate
PR-URL: https://github.com/nodejs/node/pull/59942
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-22 18:26:26 +00:00
Anna Henningsen 0ec1d186f4 src: always use strong reference to napi_async_context resource
There already is an existing requirement to have matching calls of
`napi_async_init()` and `napi_async_destroy()`, so expecting users
of this API to manually hold onto the resource for the duration of
the `napi_async_context`'s lifetime is unnecessary.

Weak callbacks are generally useful for when a corresponding C++
object should be cleaned up when a JS object is gargbage-collected,
but that is not the case here.

PR-URL: https://github.com/nodejs/node/pull/59828
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-22 14:16:10 +00:00
Anna Henningsen ce748f6cae src: use Global for storing resource in Node-API callback scope
This is a follow-up to 234c26cca3. The Node-API interface does
not allow us to enforce that values are stored in a specific location,
e.g. on the stack or not; however, V8 requires `Local<>` handles
to be stored on the stack.

To circumvent this restriction, we add the ability to the async handle
stack to store either `Local<>*` pointers or `Global<>*` pointers, with
Node-API making use of the latter.

PR-URL: https://github.com/nodejs/node/pull/59828
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-09-22 14:16:10 +00:00
Eric Rannaud cb5c8ecc5a vm: "afterEvaluate", evaluate() return a promise from the outer context
Consider the default context A with a microtask queue QA, and a
context B with its own microtask queue QB.

Context B is constructed with vm.createContext(..., {microtaskMode:
"afterEvaluate"}). The evaluation in context B can be performed via
vm.Script or vm.SourceTextModule.

The standard (https://tc39.es/ecma262/#sec-newpromiseresolvethenablejob)
dictates that, when resolving a {promise} with {resolution}, from any
context, the {then} method on {promise} should be called within a task
enqueued on the microtask queue from the context associated with {then}.

Specifically, after evaluating a script or module in context B, any
promises created within B, if later resolved within A, will result in a
task to be enqueued back onto QB, even long after we are done evaluating
any code within B.

This creates a challenge for users of node:vm in "afterEvaluate" mode.
In ContextifyScript::EvalMachine() and in ModuleWrap::Evaluate(), we
only drain the microtask queue QB a single time after running the script
or evaluating the module. After that point, the queue will not be
drained unless another script or module is evaluated in the same
context.

In the following scenario, prior to this patch, the log statement will
not be printed:

	const microtaskMode = "afterEvaluate";
	const context = vm.createContext({}, {microtaskMode});
	const source = "";
	const module = new vm.SourceTextModule(source, {context});
	await module.link(() => null);
	await module.evaluate();
	console.log("NOT PRINTED");

Within `evaluate()`, there is this `await` statement:

	await this[kWrap].evaluate(timeout, breakOnSigint)

Since the promise returned by ModuleWrap::Evaluate() is the top-level
capability for {module}, a promise created within B, V8 will enqueue a
task on QB. But since this is after the PerformCheckpoint() call in
ModuleWrap::Evaluate(), the task in QB is never run. In the meantime,
since QA is empty, the Node process simply exits (with a warning about
the unsettled promise, if it happened to be a top-level await).

While being unable to do `await module.evaluate()` is clearly a problem,
more generally, it is intended that in "afterEvaluate" mode, promises
created in the inner context cannot make progress if, and until, the
microtask queue of the inner context is checkpointed.

Therefore, to address this issue, the fix is narrow:

When the module has its own microtask queue, i.e. in "afterEvaluate"
mode, the inner-context promise returned by
v8::SourceTextModule::Evaluate() is first resolved to an outer-context
promise, then we checkpoint the microtask queue of the inner context,
then we return the outer-context promise we just built.

This ensures that in the statement `await this[kWrap].evaluate(...)`,
the promise returned can be resolved within the outer context, without
involving the microtask queue in the inner context.

Fixes: https://github.com/nodejs/node/issues/59541
Refs: https://issues.chromium.org/issues/441679231
Refs: https://groups.google.com/g/v8-dev/c/YIeRg8CUNS8/m/rEQdFuNZAAAJ
PR-URL: https://github.com/nodejs/node/pull/59801
Refs: https://tc39.es/ecma262/#sec-newpromiseresolvethenablejob
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-21 13:04:37 +00:00
Tobias Nießen f6d6b911fa src: simplify is_callable by making it a concept
Using a C++20 `concept` here makes `is_callable` much simpler
than relying on SFINAE. It is equivalent for function types,
`std::function`, lambdas, and classes with `operator()`,
regardless of argument or return types.

PR-URL: https://github.com/nodejs/node/pull/58169
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-09-20 22:44:23 +00:00