diff --git a/src/node/utils/promises.js b/src/node/utils/promises.js index 54b773d7..bc9f8c2d 100644 --- a/src/node/utils/promises.js +++ b/src/node/utils/promises.js @@ -65,6 +65,9 @@ class Gate extends Promise { static get [Symbol.species]() { return Promise; } constructor() { + // `this` is assigned when `super()` returns, not when it is called, so it is not acceptable to + // do the following because it will throw a ReferenceError when it dereferences `this`: + // super((resolve, reject) => Object.assign(this, {resolve, reject})); let props; super((resolve, reject) => props = {resolve, reject}); Object.assign(this, props);