mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 13:11:36 +00:00

Refs: https://github.com/nodejs/node-addon-api/issues/722 Ensure a scope is on stack during finalization as finalization functions can create JS Objects Signed-off-by: Michael Dawson <michael_dawson@ca.ibm.com> PR-URL: https://github.com/nodejs/node/pull/33508 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
620 B
JavaScript
19 lines
620 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
const { Worker, isMainThread } = require('worker_threads');
|
|
|
|
if (isMainThread) {
|
|
const worker = new Worker(__filename);
|
|
worker.on('error', common.mustNotCall());
|
|
} else {
|
|
const { Test } =
|
|
require(`./build/${common.buildType}/test_worker_terminate_finalization`);
|
|
|
|
// Spin up thread and call add-on create the right sequence
|
|
// of rerences to hit the case reported in
|
|
// https://github.com/nodejs/node-addon-api/issues/722
|
|
// will crash if run under debug and its not possible to
|
|
// create object in the specific finalizer
|
|
Test(new Object());
|
|
}
|