Skip to content

Commit 07968ac

Browse files
Flarnaaddaleax
authored andcommittedSep 22, 2020
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 <apechkurov@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 45d2f4d commit 07968ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎lib/async_hooks.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,16 @@ class AsyncResource {
217217
const ret = this.runInAsyncScope.bind(this, fn);
218218
ObjectDefineProperties(ret, {
219219
'length': {
220-
enumerable: true,
220+
configurable: true,
221+
enumerable: false,
221222
value: fn.length,
223+
writable: false,
222224
},
223225
'asyncResource': {
226+
configurable: true,
224227
enumerable: true,
225228
value: this,
229+
writable: true,
226230
}
227231
});
228232
return ret;

0 commit comments

Comments
 (0)
Please sign in to comment.