domain: do not add domain to promise from other context
PR-URL: https://github.com/nodejs/node/pull/39135 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
This commit is contained in:
parent
37d5739e0c
commit
f88da657f1
@ -36,6 +36,7 @@ const {
|
||||
Error,
|
||||
FunctionPrototypeCall,
|
||||
ObjectDefineProperty,
|
||||
Promise,
|
||||
ReflectApply,
|
||||
SafeMap,
|
||||
Symbol,
|
||||
@ -73,12 +74,14 @@ const asyncHook = createHook({
|
||||
if (process.domain !== null && process.domain !== undefined) {
|
||||
// If this operation is created while in a domain, let's mark it
|
||||
pairing.set(asyncId, process.domain[kWeak]);
|
||||
ObjectDefineProperty(resource, 'domain', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: process.domain,
|
||||
writable: true
|
||||
});
|
||||
if (type !== 'PROMISE' || resource instanceof Promise) {
|
||||
ObjectDefineProperty(resource, 'domain', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: process.domain,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
before(asyncId) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user