Skip to content

Commit ccc0467

Browse files
committed
[async_hooks] improve property descriptors in als.bind
The length property should be non enumerable to match behavior of normal functions. The asyncResource property is enumerable and therefore it should be also writable to avoid issues like there: nodejs#30932 (comment) Both properties should be configurable. Refs: nodejs#34574
1 parent 74df749 commit ccc0467

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/async_hooks.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,16 @@ class AsyncResource {
220220
const ret = this.runInAsyncScope.bind(this, fn);
221221
ObjectDefineProperties(ret, {
222222
'length': {
223-
enumerable: true,
223+
configurable: true,
224+
enumerable: false,
224225
value: fn.length,
226+
writable: false,
225227
},
226228
'asyncResource': {
229+
configurable: true,
227230
enumerable: true,
228231
value: this,
232+
writable: true,
229233
}
230234
});
231235
return ret;

0 commit comments

Comments
 (0)