Bug 1249595 - Enable 11 more ESLint rules for PSM. r=keeler

MozReview-Commit-ID: FxS9SPRMMxf
This commit is contained in:
Cykesiopka 2016-02-26 12:35:34 -08:00
parent b3be7b1717
commit d36ccebcb0
22 changed files with 156 additions and 128 deletions

View File

@ -6,12 +6,18 @@
// Require spacing around =>
"arrow-spacing": 2,
// Always require spacing around a single line block
"block-spacing": 2,
// No space before always a space after a comma
"comma-spacing": [2, {"before": false, "after": true}],
// Commas at the end of the line not the start
"comma-style": 2,
// Don't require spaces around computed properties
"computed-property-spacing": [2, "never"],
// Functions must always return something or nothing
"consistent-return": 2,
@ -33,6 +39,12 @@
// Always require parenthesis for new calls
"new-parens": 2,
// Use [] instead of Array()
"no-array-constructor": 2,
// Disallow use of debugger
"no-debugger": 2,
// No duplicate arguments in function declarations
"no-dupe-args": 2,
@ -45,6 +57,9 @@
// No labels
"no-labels": 2,
// If an if block ends with a return no need for an else block
"no-else-return": 2,
// No empty character classes in regex
"no-empty-character-class": 2,
@ -69,21 +84,41 @@
// No odd whitespace characters
"no-irregular-whitespace": 2,
// No single if block inside an else block
"no-lonely-if": 2,
// No mixing spaces and tabs in indent
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
// No unnecessary spacing
"no-multi-spaces": [2, { "exceptions": {
"AssignmentExpression": true,
"VariableDeclarator": true,
"ArrayExpression": true,
"ObjectExpression": true
}}],
// No reassigning native JS objects
"no-native-reassign": 2,
// No (!foo in bar)
"no-negated-in-lhs": 2,
// Nested ternary statements are confusing
"no-nested-ternary": 2,
// Use {} instead of new Object()
"no-new-object": 2,
// No Math() or JSON()
"no-obj-calls": 2,
// No octal literals
"no-octal": 2,
// No redeclaring variables
"no-redeclare": 2,
// No unnecessary comparisons
"no-self-compare": 2,
@ -111,10 +146,15 @@
// Always require semicolon at end of statement
"semi": [2, "always"],
// Require space after keywords
// Note: Replaced by keyword-spacing in ESLint v2.0.
"space-after-keywords": 2,
// Require space before blocks
"space-before-blocks": 2,
// Require spaces before finally, catch, etc.
// Note: Replaced by keyword-spacing in ESLint v2.0.
"space-before-keywords": [2, "always"],
// No space padding in parentheses
@ -124,6 +164,7 @@
"space-infix-ops": 2,
// Require spaces after return, throw and case
// Note: Replaced by keyword-spacing in ESLint v2.0.
"space-return-throw-case": 2,
// ++ and -- should not need spacing

View File

@ -28,7 +28,7 @@ function onLoad()
var rememberSetting = true;
var pref = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefService);
.getService(Components.interfaces.nsIPrefService);
if (pref) {
pref = pref.getBranch(null);
try {

View File

@ -22,40 +22,36 @@ function setWindowName()
var confirm;
var impact;
if(typeFlag == "mine_tab")
{
title = bundle.getString("deleteUserCertTitle");
confirm = bundle.getString("deleteUserCertConfirm");
impact = bundle.getString("deleteUserCertImpact");
}
else if(typeFlag == "websites_tab")
{
title = bundle.getString("deleteSslCertTitle3");
confirm = bundle.getString("deleteSslCertConfirm3");
impact = bundle.getString("deleteSslCertImpact3");
}
else if(typeFlag == "ca_tab")
{
title = bundle.getString("deleteCaCertTitle2");
confirm = bundle.getString("deleteCaCertConfirm2");
impact = bundle.getString("deleteCaCertImpactX2");
}
else if(typeFlag == "others_tab")
{
title = bundle.getString("deleteEmailCertTitle");
confirm = bundle.getString("deleteEmailCertConfirm");
impact = bundle.getString("deleteEmailCertImpactDesc");
}
else if(typeFlag == "orphan_tab")
{
title = bundle.getString("deleteOrphanCertTitle");
confirm = bundle.getString("deleteOrphanCertConfirm");
impact = "";
}
else
{
return;
switch (typeFlag) {
case "mine_tab":
title = bundle.getString("deleteUserCertTitle");
confirm = bundle.getString("deleteUserCertConfirm");
impact = bundle.getString("deleteUserCertImpact");
break;
case "websites_tab":
title = bundle.getString("deleteSslCertTitle3");
confirm = bundle.getString("deleteSslCertConfirm3");
impact = bundle.getString("deleteSslCertImpact3");
break;
case "ca_tab":
title = bundle.getString("deleteCaCertTitle2");
confirm = bundle.getString("deleteCaCertConfirm2");
impact = bundle.getString("deleteCaCertImpactX2");
break;
case "others_tab":
title = bundle.getString("deleteEmailCertTitle");
confirm = bundle.getString("deleteEmailCertConfirm");
impact = bundle.getString("deleteEmailCertImpactDesc");
break;
case "orphan_tab":
title = bundle.getString("deleteOrphanCertTitle");
confirm = bundle.getString("deleteOrphanCertConfirm");
impact = "";
break;
default:
return;
}
var confirReference = document.getElementById('confirm');
var impactReference = document.getElementById('impact');
document.title = title;

View File

@ -190,7 +190,7 @@ function enableButtons()
if (selected_token != null) {
if (selected_token.needsLogin() || !(selected_token.needsUserInit)) {
pw_toggle = "false";
if(selected_token.needsLogin()) {
if (selected_token.needsLogin()) {
if (selected_token.isLoggedIn()) {
logout_toggle = "false";
} else {

View File

@ -104,7 +104,7 @@ function checkCert() {
var req = new XMLHttpRequest();
try {
if(uri) {
if (uri) {
req.open('GET', uri.prePath, false);
req.channel.notificationCallbacks = new badCertListener();
req.send(null);

View File

@ -28,7 +28,7 @@ function onLoad()
try {
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
tokenName = params.GetString(1);
} catch(exception) {
} catch (e) {
// this should not happen.
// previously we had self.name, but self.name was a bad idea
// as window name must be a subset of ascii, and the code was

View File

@ -141,8 +141,7 @@ function exportToFile(parent, cert)
fos.init(file, 0x02 | 0x08 | 0x20, 0o0644, 0);
written = fos.write(content, content.length);
fos.close();
}
catch(e) {
} catch (e) {
switch (e.result) {
case Components.results.NS_ERROR_FILE_ACCESS_DENIED:
msg = bundle.getString("writeFileAccessDenied");

View File

@ -43,8 +43,7 @@ function resetPassword()
wallet.WALLET_DeleteAll();
}
}
}
catch(e) {
} catch (e) {
// wallet.crypto pref is missing
}
}

View File

@ -77,18 +77,10 @@ function setWindowName()
var certDetails = bundle.getString('certDetails');
if (myName != "") {
document.title = certDetails + '"' + myName + '"'; // XXX l10n?
// Get the token
// XXX ignore this for now. NSS will find the cert on a token
// by "tokenname:certname", which is what we have.
//var tokenName = "";
//var pk11db = Components.classes[nsPK11TokenDB].getService(nsIPK11TokenDB);
//var token = pk11db.findTokenByName(tokenName);
//var cert = certdb.findCertByNickname(token, myName);
cert = certdb.findCertByNickname(myName);
} else {
var params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
var cert = params.objects.queryElementAt(0, nsIX509Cert);
cert = params.objects.queryElementAt(0, nsIX509Cert);
document.title = certDetails + '"' + cert.windowTitle + '"'; // XXX l10n?
}

View File

@ -103,17 +103,13 @@ function postMsg(message)
function finish()
{
if (history.length == 1 && !bypassNavigationTest)
{
window.setTimeout(function()
{
if (history.length == 1 && !bypassNavigationTest) {
window.setTimeout(() => {
window.location.assign(navigateToInsecure ?
"http://example.com/tests/security/manager/ssl/tests/mochitest/mixedcontent/backward.html" :
"https://example.com/tests/security/manager/ssl/tests/mochitest/mixedcontent/backward.html");
}, 0);
}
else
{
} else {
postMsg("done");
window.close();
}
@ -193,7 +189,11 @@ function waitForSecurityState(expectedState, callback)
var roundsLeft = 200; // Wait for 20 seconds (=200*100ms)
var interval =
window.setInterval(function() {
isSecurityState(expectedState, "", function(isok) {if (isok) {roundsLeft = 0;}});
isSecurityState(expectedState, "", isok => {
if (isok) {
roundsLeft = 0;
}
});
if (!roundsLeft--) {
window.clearInterval(interval);
callback();

View File

@ -17,19 +17,15 @@
function runTest()
{
isSecurityState("secure");
window.setTimeout(function()
{
try
{
window.setTimeout(() => {
try {
var req = new XMLHttpRequest();
req.open("GET", "http://example.com/tests/security/manager/ssl/tests/mochitest/mixedcontent/alloworigin.sjs", false);
req.send(null);
// Change should be immediate, the request was sent synchronously
isSecurityState("broken", "security broken after insecure XHR");
}
catch (ex)
{
} catch (ex) {
ok(false, ex);
}

View File

@ -109,7 +109,7 @@
// listen for calls back from the sts-setting iframe and then
// the verification frames.
window.addEventListener("message", onMessageReceived, false);
window.addEventListener('load', function() {startRound('plain');}, false);
window.addEventListener("load", () => { startRound("plain"); }, false);
</script>
</head>

View File

@ -33,49 +33,49 @@ const MOZILLA_PKIX_ERROR_BASE = Ci.nsINSSErrorsService.MOZILLA_PKIX_ERROR_BASE;
const PRErrorCodeSuccess = 0;
// Sort in numerical order
const SEC_ERROR_INVALID_TIME = SEC_ERROR_BASE + 8;
const SEC_ERROR_BAD_DER = SEC_ERROR_BASE + 9;
const SEC_ERROR_BAD_SIGNATURE = SEC_ERROR_BASE + 10;
const SEC_ERROR_EXPIRED_CERTIFICATE = SEC_ERROR_BASE + 11;
const SEC_ERROR_REVOKED_CERTIFICATE = SEC_ERROR_BASE + 12; // -8180
const SEC_ERROR_UNKNOWN_ISSUER = SEC_ERROR_BASE + 13;
const SEC_ERROR_UNTRUSTED_ISSUER = SEC_ERROR_BASE + 20; // -8172
const SEC_ERROR_UNTRUSTED_CERT = SEC_ERROR_BASE + 21; // -8171
const SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE = SEC_ERROR_BASE + 30; // -8162
const SEC_ERROR_CA_CERT_INVALID = SEC_ERROR_BASE + 36;
const SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION = SEC_ERROR_BASE + 41;
const SEC_ERROR_INADEQUATE_KEY_USAGE = SEC_ERROR_BASE + 90; // -8102
const SEC_ERROR_INADEQUATE_CERT_TYPE = SEC_ERROR_BASE + 91; // -8101
const SEC_ERROR_CERT_NOT_IN_NAME_SPACE = SEC_ERROR_BASE + 112; // -8080
const SEC_ERROR_CERT_BAD_ACCESS_LOCATION = SEC_ERROR_BASE + 117; // -8075
const SEC_ERROR_INVALID_TIME = SEC_ERROR_BASE + 8;
const SEC_ERROR_BAD_DER = SEC_ERROR_BASE + 9;
const SEC_ERROR_BAD_SIGNATURE = SEC_ERROR_BASE + 10;
const SEC_ERROR_EXPIRED_CERTIFICATE = SEC_ERROR_BASE + 11;
const SEC_ERROR_REVOKED_CERTIFICATE = SEC_ERROR_BASE + 12;
const SEC_ERROR_UNKNOWN_ISSUER = SEC_ERROR_BASE + 13;
const SEC_ERROR_UNTRUSTED_ISSUER = SEC_ERROR_BASE + 20;
const SEC_ERROR_UNTRUSTED_CERT = SEC_ERROR_BASE + 21;
const SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE = SEC_ERROR_BASE + 30;
const SEC_ERROR_CA_CERT_INVALID = SEC_ERROR_BASE + 36;
const SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION = SEC_ERROR_BASE + 41;
const SEC_ERROR_INADEQUATE_KEY_USAGE = SEC_ERROR_BASE + 90;
const SEC_ERROR_INADEQUATE_CERT_TYPE = SEC_ERROR_BASE + 91;
const SEC_ERROR_CERT_NOT_IN_NAME_SPACE = SEC_ERROR_BASE + 112;
const SEC_ERROR_CERT_BAD_ACCESS_LOCATION = SEC_ERROR_BASE + 117;
const SEC_ERROR_OCSP_MALFORMED_REQUEST = SEC_ERROR_BASE + 120;
const SEC_ERROR_OCSP_SERVER_ERROR = SEC_ERROR_BASE + 121; // -8071
const SEC_ERROR_OCSP_SERVER_ERROR = SEC_ERROR_BASE + 121;
const SEC_ERROR_OCSP_TRY_SERVER_LATER = SEC_ERROR_BASE + 122;
const SEC_ERROR_OCSP_REQUEST_NEEDS_SIG = SEC_ERROR_BASE + 123;
const SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST = SEC_ERROR_BASE + 124;
const SEC_ERROR_OCSP_UNKNOWN_CERT = SEC_ERROR_BASE + 126; // -8066
const SEC_ERROR_OCSP_UNKNOWN_CERT = SEC_ERROR_BASE + 126;
const SEC_ERROR_OCSP_MALFORMED_RESPONSE = SEC_ERROR_BASE + 129;
const SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE = SEC_ERROR_BASE + 130;
const SEC_ERROR_OCSP_OLD_RESPONSE = SEC_ERROR_BASE + 132;
const SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE = SEC_ERROR_BASE + 141; // -8051
const SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE = SEC_ERROR_BASE + 141;
const SEC_ERROR_OCSP_INVALID_SIGNING_CERT = SEC_ERROR_BASE + 144;
const SEC_ERROR_POLICY_VALIDATION_FAILED = SEC_ERROR_BASE + 160; // -8032
const SEC_ERROR_POLICY_VALIDATION_FAILED = SEC_ERROR_BASE + 160;
const SEC_ERROR_OCSP_BAD_SIGNATURE = SEC_ERROR_BASE + 157;
const SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED = SEC_ERROR_BASE + 176;
const SSL_ERROR_NO_CYPHER_OVERLAP = SSL_ERROR_BASE + 2;
const SSL_ERROR_BAD_CERT_DOMAIN = SSL_ERROR_BASE + 12;
const SSL_ERROR_BAD_CERT_ALERT = SSL_ERROR_BASE + 17;
const SSL_ERROR_NO_CYPHER_OVERLAP = SSL_ERROR_BASE + 2;
const SSL_ERROR_BAD_CERT_DOMAIN = SSL_ERROR_BASE + 12;
const SSL_ERROR_BAD_CERT_ALERT = SSL_ERROR_BASE + 17;
const SSL_ERROR_WEAK_SERVER_CERT_KEY = SSL_ERROR_BASE + 132;
const MOZILLA_PKIX_ERROR_KEY_PINNING_FAILURE = MOZILLA_PKIX_ERROR_BASE + 0;
const MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY = MOZILLA_PKIX_ERROR_BASE + 1;
const MOZILLA_PKIX_ERROR_INADEQUATE_KEY_SIZE = MOZILLA_PKIX_ERROR_BASE + 2; // -16382
const MOZILLA_PKIX_ERROR_V1_CERT_USED_AS_CA = MOZILLA_PKIX_ERROR_BASE + 3;
const MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE = MOZILLA_PKIX_ERROR_BASE + 5;
const MOZILLA_PKIX_ERROR_KEY_PINNING_FAILURE = MOZILLA_PKIX_ERROR_BASE + 0;
const MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY = MOZILLA_PKIX_ERROR_BASE + 1;
const MOZILLA_PKIX_ERROR_INADEQUATE_KEY_SIZE = MOZILLA_PKIX_ERROR_BASE + 2;
const MOZILLA_PKIX_ERROR_V1_CERT_USED_AS_CA = MOZILLA_PKIX_ERROR_BASE + 3;
const MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE = MOZILLA_PKIX_ERROR_BASE + 5;
const MOZILLA_PKIX_ERROR_NOT_YET_VALID_ISSUER_CERTIFICATE = MOZILLA_PKIX_ERROR_BASE + 6;
const MOZILLA_PKIX_ERROR_OCSP_RESPONSE_FOR_CERT_MISSING = MOZILLA_PKIX_ERROR_BASE + 8;
const MOZILLA_PKIX_ERROR_REQUIRED_TLS_FEATURE_MISSING = MOZILLA_PKIX_ERROR_BASE + 10;
const MOZILLA_PKIX_ERROR_OCSP_RESPONSE_FOR_CERT_MISSING = MOZILLA_PKIX_ERROR_BASE + 8;
const MOZILLA_PKIX_ERROR_REQUIRED_TLS_FEATURE_MISSING = MOZILLA_PKIX_ERROR_BASE + 10;
// Supported Certificate Usages
const certificateUsageSSLClient = 0x0001;
@ -196,7 +196,7 @@ function _getLibraryFunctionWithNoArguments(functionName, libraryName) {
let nsslib;
try {
nsslib = ctypes.open(path);
} catch(e) {
} catch (e) {
// In case opening the library without a full path fails,
// try again with a full path.
let file = Services.dirsvc.get("GreBinD", Ci.nsILocalFile);
@ -482,12 +482,12 @@ function _setupTLSServerTest(serverBinName, certsPath)
// [ [typeOfResponse, certnick, extracertnick]...]
function generateOCSPResponses(ocspRespArray, nssDBlocation)
{
let utilBinName = "GenerateOCSPResponse";
let utilBinName = "GenerateOCSPResponse";
let ocspGenBin = _getBinaryUtil(utilBinName);
let retArray = new Array();
let retArray = [];
for (let i = 0; i < ocspRespArray.length; i++) {
let argArray = new Array();
let argArray = [];
let ocspFilepre = do_get_file(i.toString() + ".ocsp", true);
let filename = ocspFilepre.path;
// Using "sql:" causes the SQL DB to be used so we can run tests on Android.

View File

@ -18,22 +18,22 @@ function check_telemetry() {
.getService(Ci.nsITelemetry)
.getHistogramById("SSL_CERT_ERROR_OVERRIDES")
.snapshot();
equal(histogram.counts[ 0], 0, "Should have 0 unclassified counts");
equal(histogram.counts[ 2], 8,
equal(histogram.counts[0], 0, "Should have 0 unclassified counts");
equal(histogram.counts[2], 8,
"Actual and expected SEC_ERROR_UNKNOWN_ISSUER counts should match");
equal(histogram.counts[ 3], 1,
equal(histogram.counts[3], 1,
"Actual and expected SEC_ERROR_CA_CERT_INVALID counts should match");
equal(histogram.counts[ 4], 0,
equal(histogram.counts[4], 0,
"Actual and expected SEC_ERROR_UNTRUSTED_ISSUER counts should match");
equal(histogram.counts[ 5], 1,
equal(histogram.counts[5], 1,
"Actual and expected SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE counts should match");
equal(histogram.counts[ 6], 0,
equal(histogram.counts[6], 0,
"Actual and expected SEC_ERROR_UNTRUSTED_CERT counts should match");
equal(histogram.counts[ 7], 0,
equal(histogram.counts[7], 0,
"Actual and expected SEC_ERROR_INADEQUATE_KEY_USAGE counts should match");
equal(histogram.counts[ 8], 2,
equal(histogram.counts[8], 2,
"Actual and expected SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED counts should match");
equal(histogram.counts[ 9], 10,
equal(histogram.counts[9], 10,
"Actual and expected SSL_ERROR_BAD_CERT_DOMAIN counts should match");
equal(histogram.counts[10], 5,
"Actual and expected SEC_ERROR_EXPIRED_CERTIFICATE counts should match");

View File

@ -18,9 +18,9 @@ function excMessage(e) {
msg = msg + ": " + e.data;
}
return msg;
} else {
return e.toString();
}
return e.toString();
}
function testGood(data) {

View File

@ -19,7 +19,7 @@ var certList = [
// I have to grab them by enumerating all the certs and then finding
// the ones that I am interested in.
function get_ca_array() {
let ret_array = new Array();
let ret_array = [];
let allCerts = certdb.getCerts();
let enumerator = allCerts.getEnumerator();
while (enumerator.hasMoreElements()) {

View File

@ -20,7 +20,7 @@ function certFromFile(cert_name) {
function loadCert(cert_name, trust_string) {
let cert_filename = "test_pinning_dynamic/" + cert_name + ".pem";
addCertFromFile(certdb, cert_filename, trust_string);
addCertFromFile(certdb, cert_filename, trust_string);
return constructCertFromFile(cert_filename);
}

View File

@ -17,7 +17,7 @@ function certFromFile(cert_name) {
function loadCert(cert_name, trust_string) {
let cert_filename = "test_pinning_dynamic/" + cert_name + ".pem";
addCertFromFile(certdb, cert_filename, trust_string);
addCertFromFile(certdb, cert_filename, trust_string);
return constructCertFromFile(cert_filename);
}

View File

@ -72,7 +72,7 @@ function tamper(inFilePath, outFilePath, modifications, newEntries) {
// Any leftover modification means that we were expecting to modify an entry
// in the input file that wasn't there.
for(var name in modifications) {
for (let name in modifications) {
if (modifications.hasOwnProperty(name)) {
throw "input file was missing expected entries: " + name;
}

View File

@ -23,7 +23,7 @@ function prepare(tamper) {
if (tamper.copy) {
tamper.copy.forEach(i => {
let f = gTarget.clone();
i[0].split('/').forEach(seg => {f.append(seg);});
i[0].split("/").forEach(seg => { f.append(seg); });
f.copyTo(null, i[1]);
});
}
@ -32,7 +32,7 @@ function prepare(tamper) {
if (tamper.delete) {
tamper.delete.forEach(i => {
let f = gTarget.clone();
i.split('/').forEach(seg => {f.append(seg);});
i.split("/").forEach(seg => { f.append(seg); });
f.remove(true);
});
}
@ -41,7 +41,7 @@ function prepare(tamper) {
if (tamper.corrupt) {
tamper.corrupt.forEach(i => {
let f = gTarget.clone();
i.split('/').forEach(seg => {f.append(seg);});
i.split("/").forEach(seg => { f.append(seg); });
let s = FileUtils.openFileOutputStream(f, FileUtils.MODE_WRONLY);
const str = "Kilroy was here";
s.write(str, str.length);

View File

@ -238,7 +238,7 @@ function downloadAndParseChromeCerts(filename, certNameToSKD, certSKDToName) {
if (line.length == 0 || line[0] == '#') {
continue;
}
switch(state) {
switch (state) {
case PRE_NAME:
chromeName = line;
state = POST_NAME;

View File

@ -8,6 +8,8 @@
// 3. run `[path to]/run-mozilla.sh [path to]/xpcshell \
// [path to]/getHSTSPreloadlist.js \
// [absolute path to]/nsSTSPreloadlist.inc'
// Note: Running this file outputs a new nsSTSPreloadlist.inc in the current
// working directory.
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -128,13 +130,10 @@ function processStsHeader(host, header, status, securityInfo) {
host.name + ": " + e + "\n");
error = e;
}
}
else {
if (status == 0) {
error = ERROR_CONNECTING_TO_HOST;
} else {
error = ERROR_NO_HSTS_HEADER;
}
} else if (status == 0) {
error = ERROR_CONNECTING_TO_HOST;
} else {
error = ERROR_NO_HSTS_HEADER;
}
let forceInclude = (host.forceInclude || host.pins == "google");
@ -204,7 +203,13 @@ function getHSTSStatus(host, resultList) {
}
function compareHSTSStatus(a, b) {
return (a.name > b.name ? 1 : (a.name < b.name ? -1 : 0));
if (a.name > b.name) {
return 1;
}
if (a.name < b.name) {
return -1;
}
return 0;
}
function writeTo(string, fos) {
@ -294,7 +299,7 @@ function getHSTSStatuses(inHosts, outStatuses) {
var expectedOutputLength = inHosts.length;
var tmpOutput = [];
for (var i = 0; i < MAX_CONCURRENT_REQUESTS && inHosts.length > 0; i++) {
var host = inHosts.shift();
let host = inHosts.shift();
dump("spinning off request to '" + host.name + "' (remaining retries: " +
host.retries + ")\n");
getHSTSStatus(host, tmpOutput);
@ -311,7 +316,7 @@ function getHSTSStatuses(inHosts, outStatuses) {
}
if (inHosts.length > 0) {
var host = inHosts.shift();
let host = inHosts.shift();
dump("spinning off request to '" + host.name + "' (remaining retries: " +
host.retries + ")\n");
getHSTSStatus(host, tmpOutput);