Browse Source

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: https://github.com/nodejs/node/pull/4853
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
v4.x
Rich Trott 9 years ago
committed by Myles Borins
parent
commit
67be41ae31
  1. 8
      lib/_tls_common.js

8
lib/_tls_common.js

@ -47,7 +47,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// cert's issuer in C++ code. // cert's issuer in C++ code.
if (options.ca) { if (options.ca) {
if (Array.isArray(options.ca)) { if (Array.isArray(options.ca)) {
for (var i = 0, len = options.ca.length; i < len; i++) { for (let i = 0, len = options.ca.length; i < len; i++) {
c.context.addCACert(options.ca[i]); c.context.addCACert(options.ca[i]);
} }
} else { } else {
@ -59,7 +59,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
if (options.cert) { if (options.cert) {
if (Array.isArray(options.cert)) { if (Array.isArray(options.cert)) {
for (var i = 0; i < options.cert.length; i++) for (let i = 0; i < options.cert.length; i++)
c.context.setCert(options.cert[i]); c.context.setCert(options.cert[i]);
} else { } else {
c.context.setCert(options.cert); c.context.setCert(options.cert);
@ -72,7 +72,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// which leads to the crash later on. // which leads to the crash later on.
if (options.key) { if (options.key) {
if (Array.isArray(options.key)) { if (Array.isArray(options.key)) {
for (var i = 0; i < options.key.length; i++) { for (let i = 0; i < options.key.length; i++) {
var key = options.key[i]; var key = options.key[i];
if (key.passphrase) if (key.passphrase)
@ -103,7 +103,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
if (options.crl) { if (options.crl) {
if (Array.isArray(options.crl)) { if (Array.isArray(options.crl)) {
for (var i = 0, len = options.crl.length; i < len; i++) { for (let i = 0, len = options.crl.length; i < len; i++) {
c.context.addCRL(options.crl[i]); c.context.addCRL(options.crl[i]);
} }
} else { } else {

Loading…
Cancel
Save