mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 21:46:48 +00:00

Test that an napi_ref can be nested inside another ObjectWrap. The test shows a critical case where a finalizer deletes an `napi_ref` whose finalizer is also scheduled. PR-URL: https://github.com/nodejs/node/pull/57981 Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
15 lines
346 B
JavaScript
15 lines
346 B
JavaScript
// Flags: --expose-gc
|
|
|
|
'use strict';
|
|
const common = require('../../common');
|
|
const addon = require(`./build/${common.buildType}/myobject`);
|
|
const { gcUntil } = require('../../common/gc');
|
|
|
|
(function scope() {
|
|
addon.objectWrapDanglingReference({});
|
|
})();
|
|
|
|
gcUntil('object-wrap-ref', () => {
|
|
return addon.objectWrapDanglingReferenceTest();
|
|
});
|