Skip to content

async_hooks: use parent promise as triggerId in init hook

async_hooks init callback will be triggered when promise newly created, in previous version, the parent promise which pass from chrome V8 PromiseHook is ignored, so we can't tell the promise is a pure new promise or a chained promise.

In this commit, we use the parent promise's id as triggerId to trigger the init callback.

Fixes: https://github.com/nodejs/node/issues/13302

Thanks for @AndreasMadsen and @addaleax 's great help!

Please review.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

Merge request reports

Loading