Skip to content

Commit 3b4159c

Browse files
sam-githubTrott
authored andcommitted
tls: remove unused arg to createSecureContext()
The context arg is unused by node or its test suites and undocumented. Remove it. PR-URL: #24241 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 624a242 commit 3b4159c

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

lib/_tls_common.js

+6-17
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,13 @@ const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto;
3535
let toBuf = null;
3636

3737
const { SecureContext: NativeSecureContext } = internalBinding('crypto');
38-
function SecureContext(secureProtocol, secureOptions, context) {
38+
function SecureContext(secureProtocol, secureOptions) {
3939
if (!(this instanceof SecureContext)) {
40-
return new SecureContext(secureProtocol, secureOptions, context);
40+
return new SecureContext(secureProtocol, secureOptions);
4141
}
4242

43-
if (context) {
44-
this.context = context;
45-
} else {
46-
this.context = new NativeSecureContext();
47-
48-
if (secureProtocol) {
49-
this.context.init(secureProtocol);
50-
} else {
51-
this.context.init();
52-
}
53-
}
43+
this.context = new NativeSecureContext();
44+
this.context.init(secureProtocol);
5445

5546
if (secureOptions) this.context.setOptions(secureOptions);
5647
}
@@ -68,19 +59,17 @@ function validateKeyCert(name, value) {
6859
exports.SecureContext = SecureContext;
6960

7061

71-
exports.createSecureContext = function createSecureContext(options, context) {
62+
exports.createSecureContext = function createSecureContext(options) {
7263
if (!options) options = {};
7364

7465
var secureOptions = options.secureOptions;
7566
if (options.honorCipherOrder)
7667
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE;
7768

78-
const c = new SecureContext(options.secureProtocol, secureOptions, context);
69+
const c = new SecureContext(options.secureProtocol, secureOptions);
7970
var i;
8071
var val;
8172

82-
if (context) return c;
83-
8473
// NOTE: It's important to add CA before the cert to be able to load
8574
// cert's issuer in C++ code.
8675
const { ca } = options;

0 commit comments

Comments
 (0)