mirror of https://github.com/nodejs/node.git
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: https://github.com/nodejs/node/pull/30932#discussion_r379679982 Both properties should be configurable. Refs: https://github.com/nodejs/node/pull/34574 PR-URL: https://github.com/nodejs/node/pull/34620 Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
0bb70b0a02
commit
3ea94ec845
|
@ -220,12 +220,16 @@ class AsyncResource {
|
|||
const ret = this.runInAsyncScope.bind(this, fn);
|
||||
ObjectDefineProperties(ret, {
|
||||
'length': {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: fn.length,
|
||||
writable: false,
|
||||
},
|
||||
'asyncResource': {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: this,
|
||||
writable: true,
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue