Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const {
ArrayPrototypePush,
ArrayPrototypeSlice,
Error,
FunctionPrototypeCall,
NumberIsNaN,
ObjectAssign,
ObjectDefineProperty,
ObjectIs,
ObjectKeys,
ObjectPrototypeIsPrototypeOf,
ReflectApply,
RegExpPrototypeExec,
String,
StringPrototypeIndexOf,
Expand Down Expand Up @@ -544,7 +544,7 @@ function expectedException(actual, expected, message, fn) {
throwError = true;
} else {
// Check validation functions return value.
const res = ReflectApply(expected, {}, [actual]);
const res = FunctionPrototypeCall(expected, {}, actual);
if (res !== true) {
if (!message) {
generatedMessage = true;
Expand Down Expand Up @@ -689,7 +689,7 @@ function hasMatchingError(actual, expected) {
if (ObjectPrototypeIsPrototypeOf(Error, expected)) {
return false;
}
return ReflectApply(expected, {}, [actual]) === true;
return FunctionPrototypeCall(expected, {}, actual) === true;
}

function expectsNoError(stackStartFn, actual, error, message) {
Expand Down
3 changes: 1 addition & 2 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const {
FunctionPrototypeCall,
ObjectDefineProperty,
ObjectSetPrototypeOf,
ReflectApply,
SymbolAsyncDispose,
SymbolDispose,
} = primordials;
Expand Down Expand Up @@ -436,7 +435,7 @@ Socket.prototype.connect = function(port, address, callback) {
return;
}

ReflectApply(_connect, this, [port, address, callback]);
FunctionPrototypeCall(_connect, this, port, address, callback);
};


Expand Down
3 changes: 2 additions & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {
ArrayPrototypePush,
BigIntPrototypeToString,
Boolean,
FunctionPrototypeCall,
MathMax,
Number,
ObjectDefineProperties,
Expand Down Expand Up @@ -366,7 +367,7 @@ function readFile(path, options, callback) {
}
if (context.isUserFd) {
process.nextTick(function tick(context) {
ReflectApply(readFileAfterOpen, { context }, [null, path]);
FunctionPrototypeCall(readFileAfterOpen, { context }, null, path);
}, context);
return;
}
Expand Down
3 changes: 1 addition & 2 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,7 @@ function setupChannel(target, channel, serializationMode) {
obj = handleConversion[message.type];

// convert TCP object to native handle object
handle = ReflectApply(handleConversion[message.type].send,
target, [message, handle, options]);
handle = FunctionPrototypeCall(handleConversion[message.type].send, target, message, handle, options);

// If handle was sent twice, or it is impossible to get native handle
// out of it - just send a text without the handle.
Expand Down
5 changes: 3 additions & 2 deletions lib/internal/cluster/child.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const {
ArrayPrototypeJoin,
FunctionPrototype,
FunctionPrototypeCall,
ObjectAssign,
ReflectApply,
SafeMap,
Expand Down Expand Up @@ -58,7 +59,7 @@ cluster._setupWorker = function() {
if (message.act === 'newconn')
onconnection(message, handle);
else if (message.act === 'disconnect')
ReflectApply(_disconnect, worker, [true]);
FunctionPrototypeCall(_disconnect, worker, true);
}
};

Expand Down Expand Up @@ -287,7 +288,7 @@ function _disconnect(primaryInitiated) {
Worker.prototype.disconnect = function() {
if (this.state !== 'disconnecting' && this.state !== 'destroying') {
this.state = 'disconnecting';
ReflectApply(_disconnect, this, []);
FunctionPrototypeCall(_disconnect, this);
}

return this;
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/cluster/worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
FunctionPrototypeCall,
ObjectSetPrototypeOf,
ReflectApply,
} = primordials;
Expand All @@ -16,7 +17,7 @@ function Worker(options) {
if (!(this instanceof Worker))
return new Worker(options);

ReflectApply(EventEmitter, this, []);
FunctionPrototypeCall(EventEmitter, this);

if (options === null || typeof options !== 'object')
options = kEmptyObject;
Expand Down
10 changes: 5 additions & 5 deletions lib/internal/crypto/cipher.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

const {
FunctionPrototypeCall,
NumberIsInteger,
ObjectSetPrototypeOf,
ReflectApply,
} = primordials;

const {
Expand Down Expand Up @@ -117,15 +117,15 @@ function createCipherBase(cipher, credential, options, isEncrypt, iv) {
this[kHandle] = new CipherBase(isEncrypt, cipher, credential, iv, authTagLength);
this._decoder = null;

ReflectApply(LazyTransform, this, [options]);
FunctionPrototypeCall(LazyTransform, this, options);
}

function createCipherWithIV(cipher, key, options, isEncrypt, iv) {
validateString(cipher, 'cipher');
const encoding = getStringOption(options, 'encoding');
key = prepareSecretKey(key, encoding);
iv = iv === null ? null : getArrayBufferOrView(iv, 'iv');
ReflectApply(createCipherBase, this, [cipher, key, options, isEncrypt, iv]);
FunctionPrototypeCall(createCipherBase, this, cipher, key, options, isEncrypt, iv);
}

// The Cipher class is part of the legacy Node.js crypto API. It exposes
Expand Down Expand Up @@ -215,7 +215,7 @@ function Cipheriv(cipher, key, iv, options) {
if (!(this instanceof Cipheriv))
return new Cipheriv(cipher, key, iv, options);

ReflectApply(createCipherWithIV, this, [cipher, key, options, true, iv]);
FunctionPrototypeCall(createCipherWithIV, this, cipher, key, options, true, iv);
}

function addCipherPrototypeFunctions(constructor) {
Expand Down Expand Up @@ -244,7 +244,7 @@ function Decipheriv(cipher, key, iv, options) {
if (!(this instanceof Decipheriv))
return new Decipheriv(cipher, key, iv, options);

ReflectApply(createCipherWithIV, this, [cipher, key, options, false, iv]);
FunctionPrototypeCall(createCipherWithIV, this, cipher, key, options, false, iv);
}

ObjectSetPrototypeOf(Decipheriv.prototype, LazyTransform.prototype);
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/crypto/hash.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const {
FunctionPrototypeCall,
ObjectSetPrototypeOf,
ReflectApply,
StringPrototypeReplace,
StringPrototypeToLowerCase,
Symbol,
Expand Down Expand Up @@ -105,7 +105,7 @@ function Hash(algorithm, options) {
if (!isCopy && xofLen === undefined) {
maybeEmitDeprecationWarning(algorithm);
}
ReflectApply(LazyTransform, this, [options]);
FunctionPrototypeCall(LazyTransform, this, options);
}

ObjectSetPrototypeOf(Hash.prototype, LazyTransform.prototype);
Expand Down Expand Up @@ -169,7 +169,7 @@ function Hmac(hmac, key, options) {
this[kState] = {
[kFinalized]: false,
};
ReflectApply(LazyTransform, this, [options]);
FunctionPrototypeCall(LazyTransform, this, options);
}

ObjectSetPrototypeOf(Hmac.prototype, LazyTransform.prototype);
Expand Down
5 changes: 2 additions & 3 deletions lib/internal/crypto/sig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const {
FunctionPrototypeCall,
ObjectSetPrototypeOf,
ReflectApply,
} = primordials;

const {
Expand Down Expand Up @@ -59,7 +58,7 @@ function Sign(algorithm, options) {
this[kHandle] = new _Sign();
this[kHandle].init(algorithm);

ReflectApply(Writable, this, [options]);
FunctionPrototypeCall(Writable, this, options);
}

ObjectSetPrototypeOf(Sign.prototype, Writable.prototype);
Expand Down Expand Up @@ -219,7 +218,7 @@ function Verify(algorithm, options) {
this[kHandle] = new _Verify();
this[kHandle].init(algorithm);

ReflectApply(Writable, this, [options]);
FunctionPrototypeCall(Writable, this, options);
}

ObjectSetPrototypeOf(Verify.prototype, Writable.prototype);
Expand Down
25 changes: 13 additions & 12 deletions lib/internal/crypto/webcrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {
ArrayPrototypeIncludes,
FunctionPrototypeCall,
JSONParse,
JSONStringify,
ObjectDefineProperties,
Expand Down Expand Up @@ -84,7 +85,7 @@ async function digest(algorithm, data) {

algorithm = normalizeAlgorithm(algorithm, 'digest');

return await ReflectApply(asyncDigest, this, [algorithm, data]);
return await FunctionPrototypeCall(asyncDigest, this, algorithm, data);
}

function randomUUID() {
Expand Down Expand Up @@ -377,10 +378,10 @@ async function deriveKey(
throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError');
}

return ReflectApply(
return FunctionPrototypeCall(
importKeySync,
this,
['raw-secret', bits, derivedKeyAlgorithm, extractable, keyUsages],
'raw-secret', bits, derivedKeyAlgorithm, extractable, keyUsages,
);
}

Expand Down Expand Up @@ -889,10 +890,10 @@ async function importKey(

algorithm = normalizeAlgorithm(algorithm, 'importKey');

return ReflectApply(
return FunctionPrototypeCall(
importKeySync,
this,
[format, keyData, algorithm, extractable, keyUsages],
format, keyData, algorithm, extractable, keyUsages,
);
}

Expand Down Expand Up @@ -926,7 +927,7 @@ async function wrapKey(format, key, wrappingKey, algorithm) {
} catch {
algorithm = normalizeAlgorithm(algorithm, 'encrypt');
}
let keyData = await ReflectApply(exportKey, this, [format, key]);
let keyData = await FunctionPrototypeCall(exportKey, this, format, key);

if (format === 'jwk') {
const ec = new TextEncoder();
Expand Down Expand Up @@ -1023,10 +1024,10 @@ async function unwrapKey(
}
}

return ReflectApply(
return FunctionPrototypeCall(
importKeySync,
this,
[format, keyData, unwrappedKeyAlgo, extractable, keyUsages],
format, keyData, unwrappedKeyAlgo, extractable, keyUsages,
);
}

Expand Down Expand Up @@ -1349,10 +1350,10 @@ async function encapsulateKey(encapsulationAlgorithm, encapsulationKey, sharedKe
throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError');
}

const sharedKey = ReflectApply(
const sharedKey = FunctionPrototypeCall(
importKeySync,
this,
['raw-secret', encapsulateBits.sharedKey, normalizedSharedKeyAlgorithm, extractable, usages],
'raw-secret', encapsulateBits.sharedKey, normalizedSharedKeyAlgorithm, extractable, usages,
);

const encapsulatedKey = {
Expand Down Expand Up @@ -1469,10 +1470,10 @@ async function decapsulateKey(
throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError');
}

return ReflectApply(
return FunctionPrototypeCall(
importKeySync,
this,
['raw-secret', decapsulatedBits, normalizedSharedKeyAlgorithm, extractable, usages],
'raw-secret', decapsulatedBits, normalizedSharedKeyAlgorithm, extractable, usages,
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/dns/callback_resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const {
ArrayPrototypeMap,
FunctionPrototypeCall,
ObjectDefineProperty,
ReflectApply,
Symbol,
} = primordials;

Expand Down Expand Up @@ -104,7 +104,7 @@ function resolve(hostname, rrtype, callback) {
}

if (typeof resolver === 'function') {
return ReflectApply(resolver, this, [hostname, callback]);
return FunctionPrototypeCall(resolver, this, hostname, callback);
}
throw new ERR_INVALID_ARG_VALUE('rrtype', rrtype);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/dns/promises.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
const {
ArrayPrototypeMap,
FunctionPrototypeCall,
ObjectDefineProperty,
Promise,
ReflectApply,
Symbol,
} = primordials;

Expand Down Expand Up @@ -358,7 +358,7 @@ function resolve(hostname, rrtype) {
resolver = resolveMap.A;
}

return ReflectApply(resolver, this, [hostname]);
return FunctionPrototypeCall(resolver, this, hostname);
}

// Promise-based resolver.
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const {
DateNow,
FunctionPrototypeApply,
FunctionPrototypeCall,
NumberIsNaN,
ObjectDefineProperties,
ObjectSetPrototypeOf,
Expand Down Expand Up @@ -129,7 +129,7 @@ class File extends Blob {
}

function TransferableFile(handle, length, type = '') {
FunctionPrototypeApply(TransferableBlob, this, [handle, length, type]);
FunctionPrototypeCall(TransferableBlob, this, handle, length, type);
ObjectSetPrototypeOf(this, File.prototype);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/fs/read/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const {
ArrayPrototypePush,
FunctionPrototypeCall,
MathMin,
ReflectApply,
} = primordials;

const {
Expand Down Expand Up @@ -112,7 +112,7 @@ class ReadFileContext {
close(err) {
if (this.isUserFd) {
process.nextTick(function tick(context) {
ReflectApply(readFileAfterClose, { context }, [null]);
FunctionPrototypeCall(readFileAfterClose, { context }, null);
}, this);
return;
}
Expand Down
Loading
Loading