mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 17:03:34 +00:00

When deleting a weak reference that has no finalizer we must not defer deletion until the non-existent finalizer gets called. Fixes: https://github.com/nodejs/node/issues/34731 Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com> PR-URL: https://github.com/nodejs/node/pull/34839 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
20 lines
621 B
JavaScript
20 lines
621 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());
|
|
}
|