Skip to content

Commit 62479e3

Browse files
Trottrvagg
authored andcommitted
tls: scope loop vars with let
`lib/_tls_common.js` had instances of `for` loops that defined variables with `var` such that they were re-declared in the same scope. This change scopes those variables with `let` so that they are not re-declared. PR-URL: #4853 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 19ed619 commit 62479e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/_tls_common.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
4747
// cert's issuer in C++ code.
4848
if (options.ca) {
4949
if (Array.isArray(options.ca)) {
50-
for (var i = 0, len = options.ca.length; i < len; i++) {
50+
for (let i = 0, len = options.ca.length; i < len; i++) {
5151
c.context.addCACert(options.ca[i]);
5252
}
5353
} else {
@@ -59,7 +59,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
5959

6060
if (options.cert) {
6161
if (Array.isArray(options.cert)) {
62-
for (var i = 0; i < options.cert.length; i++)
62+
for (let i = 0; i < options.cert.length; i++)
6363
c.context.setCert(options.cert[i]);
6464
} else {
6565
c.context.setCert(options.cert);
@@ -72,7 +72,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
7272
// which leads to the crash later on.
7373
if (options.key) {
7474
if (Array.isArray(options.key)) {
75-
for (var i = 0; i < options.key.length; i++) {
75+
for (let i = 0; i < options.key.length; i++) {
7676
var key = options.key[i];
7777

7878
if (key.passphrase)
@@ -107,7 +107,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
107107

108108
if (options.crl) {
109109
if (Array.isArray(options.crl)) {
110-
for (var i = 0, len = options.crl.length; i < len; i++) {
110+
for (let i = 0, len = options.crl.length; i < len; i++) {
111111
c.context.addCRL(options.crl[i]);
112112
}
113113
} else {

0 commit comments

Comments
 (0)