mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
domain: set .domain
non-enumerable on resources
In particular, this comes into play in the node repl, which apparently enables domains by default. Whenever any Promise gets inspected, a `.domain` property is displayed, which is *very confusing*, especially since it has some kind of WeakReference attached to it, which is not yet a language feature. This change will prevent it from showing up in casual inspection, but will leave it available for use. PR-URL: https://github.com/nodejs/node/pull/26210 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
parent
8cbbe73553
commit
377c5835e8
5 changed files with 53 additions and 7 deletions
|
@ -4,6 +4,7 @@ const common = require('../common');
|
|||
const assert = require('assert');
|
||||
const domain = require('domain');
|
||||
const fs = require('fs');
|
||||
const isEnumerable = Function.call.bind(Object.prototype.propertyIsEnumerable);
|
||||
|
||||
{
|
||||
const d = new domain.Domain();
|
||||
|
@ -11,6 +12,7 @@ const fs = require('fs');
|
|||
d.on('error', common.mustCall((err) => {
|
||||
assert.strictEqual(err.message, 'foobar');
|
||||
assert.strictEqual(err.domain, d);
|
||||
assert.strictEqual(isEnumerable(err, 'domain'), false);
|
||||
assert.strictEqual(err.domainEmitter, undefined);
|
||||
assert.strictEqual(err.domainBound, undefined);
|
||||
assert.strictEqual(err.domainThrown, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue