Skip to content

Commit 0730c76

Browse files
Flarnacodebytere
authored andcommitted
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: #30932 (comment) Both properties should be configurable. Refs: #34574 PR-URL: #34620 Reviewed-By: Andrey Pechkurov <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ef4fb68 commit 0730c76

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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)