Skip to content

Commit 2e83988

Browse files
committed
fixup! fixup! fixup! src: always use strong reference to napi_async_context resource
1 parent 901e10a commit 2e83988

File tree

2 files changed

+3
-50
lines changed

2 files changed

+3
-50
lines changed

test/node-api/test_async_context/test-gcable-callback.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,10 @@ setImmediate(() => {
5050
assert.strictEqual(hook_result.destroy_called, false);
5151
makeCallback(asyncResource, process, () => {
5252
const executionAsyncResource = async_hooks.executionAsyncResource();
53-
// Assuming the executionAsyncResource was created for the absence of the
54-
// initial `{ foo: 'bar' }`.
55-
// This is the worst path of `napi_async_context` related API of
56-
// recovering from the condition and not break the executionAsyncResource
57-
// shape, although the executionAsyncResource might not be correct.
53+
// Previous versions of Node-API would have gargbage-collected
54+
// the `asyncResource` object, now we can just assert that it is intact.
5855
assert.strictEqual(typeof executionAsyncResource, 'object');
59-
assert.strictEqual(executionAsyncResource.foo, undefined);
56+
assert.strictEqual(executionAsyncResource.foo, 'bar');
6057
destroyAsyncResource(asyncResource);
6158
setImmediate(() => {
6259
assert.strictEqual(hook_result.destroy_called, true);

test/node-api/test_async_context/test-gcable.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)