mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
2243d79f74
646e5a4717
changed the way that the domain hook callback is called. Previously, the callback was only used in the case that async_hooks were *not* being used (since domains already integrate with async hooks the way they should), and the corresponding deprecation warning also only emitted in that case. However, that commit didn’t move that condition along when the code was ported from C++ to JS. As a consequence, the domain hook callback was used when it wasn’t necessary to use it, and the deprecation warning emitted accidentally along with it. Refs:646e5a4717 (diff-9f21ce1b9d6d46fdd07b969e8a04e140L192)
Refs:646e5a4717 (diff-e6db408e12db906ead6ddfac3de15a6fR119)
Refs: https://github.com/nodejs/node/pull/33801#issuecomment-654744913 PR-URL: https://github.com/nodejs/node/pull/34245 Fixes: https://github.com/nodejs/node/issues/34069 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const domain = require('domain');
|
|
const fs = require('fs');
|
|
const isEnumerable = Function.call.bind(Object.prototype.propertyIsEnumerable);
|
|
|
|
process.on('warning', common.mustNotCall());
|
|
|
|
{
|
|
const d = new domain.Domain();
|
|
|
|
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);
|
|
}));
|
|
|
|
d.run(common.mustCall(() => {
|
|
process.nextTick(common.mustCall(() => {
|
|
const i = setInterval(common.mustCall(() => {
|
|
clearInterval(i);
|
|
setTimeout(common.mustCall(() => {
|
|
fs.stat('this file does not exist', common.mustCall((er, stat) => {
|
|
throw new Error('foobar');
|
|
}));
|
|
}), 1);
|
|
}), 1);
|
|
}));
|
|
}));
|
|
}
|