src: move process.binding('signal_wrap') to internalBinding
PR-URL: https://github.com/nodejs/node/pull/22290 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
884b23daf7
commit
0bdb95f4cf
@ -67,7 +67,7 @@
|
||||
perThreadSetup.setupConfig(NativeModule._source);
|
||||
|
||||
if (isMainThread) {
|
||||
mainThreadSetup.setupSignalHandlers();
|
||||
mainThreadSetup.setupSignalHandlers(internalBinding);
|
||||
}
|
||||
|
||||
perThreadSetup.setupUncaughtExceptionCapture(exceptionHandlerState,
|
||||
@ -349,7 +349,8 @@
|
||||
'uv',
|
||||
'http_parser',
|
||||
'v8',
|
||||
'stream_wrap']);
|
||||
'stream_wrap',
|
||||
'signal_wrap']);
|
||||
process.binding = function binding(name) {
|
||||
return internalBindingWhitelist.has(name) ?
|
||||
internalBinding(name) :
|
||||
|
@ -117,7 +117,7 @@ function setupPosixMethods(_initgroups, _setegid, _seteuid,
|
||||
}
|
||||
|
||||
// Worker threads don't receive signals.
|
||||
function setupSignalHandlers() {
|
||||
function setupSignalHandlers(internalBinding) {
|
||||
const constants = process.binding('constants').os.signals;
|
||||
const signalWraps = Object.create(null);
|
||||
let Signal;
|
||||
@ -130,7 +130,7 @@ function setupSignalHandlers() {
|
||||
process.on('newListener', function(type) {
|
||||
if (isSignal(type) && signalWraps[type] === undefined) {
|
||||
if (Signal === undefined)
|
||||
Signal = process.binding('signal_wrap').Signal;
|
||||
Signal = internalBinding('signal_wrap').Signal;
|
||||
const wrap = new Signal();
|
||||
|
||||
wrap.unref();
|
||||
|
@ -128,4 +128,4 @@ class SignalWrap : public HandleWrap {
|
||||
} // namespace node
|
||||
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(signal_wrap, node::SignalWrap::Initialize)
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(signal_wrap, node::SignalWrap::Initialize)
|
||||
|
@ -10,3 +10,4 @@ assert(process.binding('uv'));
|
||||
assert(process.binding('http_parser'));
|
||||
assert(process.binding('v8'));
|
||||
assert(process.binding('stream_wrap'));
|
||||
assert(process.binding('signal_wrap'));
|
||||
|
@ -1,7 +1,9 @@
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const Signal = process.binding('signal_wrap').Signal;
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const { Signal } = internalBinding('signal_wrap');
|
||||
|
||||
// Test Signal `this` safety
|
||||
// https://github.com/joyent/node/issues/6690
|
||||
|
@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
// Flags: --expose-gc --expose-internals
|
||||
// Flags: --expose-gc --expose-internals --no-warnings
|
||||
|
||||
const common = require('../common');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
@ -187,7 +187,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
|
||||
}
|
||||
|
||||
{
|
||||
const Signal = process.binding('signal_wrap').Signal;
|
||||
const { Signal } = internalBinding('signal_wrap');
|
||||
testInitialized(new Signal(), 'Signal');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user