Bug 1246365 - Enable eslint "comma-spacing" and "semi" rules for PSM. r=keeler

MozReview-Commit-ID: 7FVcD7O9mpG

--HG--
extra : transplant_source : R%C3B%B73%0A%9E%FA%83_%CF%FE%86O%B4%FF%C4f%EB%9C
This commit is contained in:
Cykesiopka 2016-02-18 21:16:50 -08:00
Родитель 92a150b47f
Коммит f64795a71b
31 изменённых файлов: 125 добавлений и 103 удалений

Просмотреть файл

@ -6,6 +6,9 @@
// Require spacing around =>
"arrow-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,
@ -105,6 +108,9 @@
// No using with
"no-with": 2,
// Always require semicolon at end of statement
"semi": [2, "always"],
// Require space before blocks
"space-before-blocks": 2,

Просмотреть файл

@ -55,14 +55,18 @@ function onCertSelected()
function doOK()
{
dialogParams.SetInt(0,1);
var index = parseInt(document.getElementById("nicknames").value);
// Signal that the user accepted.
dialogParams.SetInt(0, 1);
// Signal the index of the selected cert in the list of cert nicknames
// provided.
let index = parseInt(document.getElementById("nicknames").value);
dialogParams.SetInt(1, index);
return true;
}
function doCancel()
{
dialogParams.SetInt(0,0);
dialogParams.SetInt(0, 0); // Signal that the user cancelled.
return true;
}

Просмотреть файл

@ -28,15 +28,16 @@ function onLoad()
function doOK()
{
var tokenList = document.getElementById("tokens");
var token = tokenList.value;
dialogParams.SetInt(0,1);
dialogParams.SetString(0, token);
let tokenList = document.getElementById("tokens");
// Signal that the user accepted.
dialogParams.SetInt(0, 1);
// Signal the name of the token the user chose.
dialogParams.SetString(0, tokenList.value);
return true;
}
function doCancel()
{
dialogParams.SetInt(0,0);
dialogParams.SetInt(0, 0); // Signal that the user cancelled.
return true;
}

Просмотреть файл

@ -80,17 +80,24 @@ function onCertSelected()
function doOK()
{
dialogParams.SetInt(0,1);
var index = parseInt(document.getElementById("nicknames").value);
// Signal that the user accepted.
dialogParams.SetInt(0, 1);
let index = parseInt(document.getElementById("nicknames").value);
// Signal the index of the selected cert in the list of cert nicknames
// provided.
dialogParams.SetInt(1, index);
// Signal whether the user wanted to remember the selection.
dialogParams.SetInt(2, rememberBox.checked);
return true;
}
function doCancel()
{
dialogParams.SetInt(0,0);
// Signal that the user cancelled.
dialogParams.SetInt(0, 0);
// Signal some invalid index value since a cert hasn't actually been chosen.
dialogParams.SetInt(1, -1); // invalid value
// Signal whether the user wanted to remember the "selection".
dialogParams.SetInt(2, rememberBox.checked);
return true;
}

Просмотреть файл

@ -60,7 +60,7 @@ function setWindowName()
var impactReference = document.getElementById('impact');
document.title = title;
setText("confirm",confirm);
setText("confirm", confirm);
let box = document.getElementById("certlist");
for (let x = 0; x < numberOfCerts; x++) {
@ -71,7 +71,7 @@ function setWindowName()
box.appendChild(listItem);
}
setText("impact",impact);
setText("impact", impact);
}
function doOK()

Просмотреть файл

@ -468,7 +468,7 @@ function doLoadDevice()
var name_box = document.getElementById("device_name");
var path_box = document.getElementById("device_path");
try {
getPKCS11().addModule(name_box.value, path_box.value, 0,0);
getPKCS11().addModule(name_box.value, path_box.value, 0, 0);
} catch (e) {
if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
doPrompt(getNSSString("AddModuleDup"));

Просмотреть файл

@ -48,6 +48,6 @@ function doOK()
function doCancel()
{
params.SetInt(1,0);
params.SetInt(1, 0); // Signal that the user cancelled.
return true;
}

Просмотреть файл

@ -41,7 +41,7 @@ badCertListener.prototype = {
this.handle_test_result();
return true; // suppress error UI
}
}
};
function initExceptionDialog() {
gNeedReset = false;

Просмотреть файл

@ -65,7 +65,7 @@ function onLoad()
var sel = document.getElementById("tokenMenu");
sel.setAttribute("hidden", "true");
var tag = document.getElementById("tokenName");
tag.setAttribute("value",tokenName);
tag.setAttribute("value", tokenName);
}
process();

Просмотреть файл

@ -21,7 +21,7 @@ function setText(id, value) {
}
const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1";
function viewCertHelper(parent, cert) {
if (!cert) {

Просмотреть файл

@ -11,7 +11,7 @@ const nsIASN1Object = Components.interfaces.nsIASN1Object;
const nsIASN1Sequence = Components.interfaces.nsIASN1Sequence;
const nsIASN1PrintableItem = Components.interfaces.nsIASN1PrintableItem;
const nsIASN1Tree = Components.interfaces.nsIASN1Tree;
const nsASN1Tree = "@mozilla.org/security/nsASN1Tree;1"
const nsASN1Tree = "@mozilla.org/security/nsASN1Tree;1";
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
var bundle;
@ -23,12 +23,19 @@ function doPrompt(msg)
prompts.alert(window, null, msg);
}
function AddCertChain(node, chain, idPrefix)
/**
* Fills out the "Certificate Hierarchy" tree of the cert viewer "Details" tab.
*
* @param {tree} node
* Parent tree node to append to.
* @param {nsIArray<nsIX509Cert>} chain
* Chain where cert element n is issued by cert element n + 1.
*/
function AddCertChain(node, chain)
{
var child = document.getElementById(node);
var currCert;
var displayVal;
var addTwistie;
for (let i = chain.length - 1; i >= 0; i--) {
currCert = chain.queryElementAt(i, nsIX509Cert);
if (currCert.commonName) {
@ -36,18 +43,22 @@ function AddCertChain(node, chain, idPrefix)
} else {
displayVal = currCert.windowTitle;
}
if (0 == i) {
addTwistie = false;
} else {
addTwistie = true;
}
child = addChildrenToTree(child, displayVal, currCert.dbKey,addTwistie);
let addTwistie = i != 0;
child = addChildrenToTree(child, displayVal, currCert.dbKey, addTwistie);
}
}
function AddUsage(usage,verifyInfoBox)
/**
* Adds a "verified usage" of a cert to the "General" tab of the cert viewer.
*
* @param {String} usage
* Verified usage to add.
* @param {Node} verifyInfoBox
* Parent node to append to.
*/
function AddUsage(usage, verifyInfoBox)
{
var text = document.createElement("textbox");
let text = document.createElement("textbox");
text.setAttribute("value", usage);
text.setAttribute("style", "margin: 2px 5px");
text.setAttribute("readonly", "true");
@ -86,33 +97,33 @@ function setWindowName()
//
// The chain of trust
var chain = cert.getChain();
AddCertChain("treesetDump", chain, "dump_");
AddCertChain("treesetDump", cert.getChain());
DisplayGeneralDataFromCert(cert);
BuildPrettyPrint(cert);
cert.requestUsagesArrayAsync(new listener());
}
function addChildrenToTree(parentTree,label,value,addTwistie)
function addChildrenToTree(parentTree, label, value, addTwistie)
{
var treeChild1 = document.createElement("treechildren");
var treeElement = addTreeItemToTreeChild(treeChild1,label,value,addTwistie);
let treeChild1 = document.createElement("treechildren");
let treeElement = addTreeItemToTreeChild(treeChild1, label, value,
addTwistie);
parentTree.appendChild(treeChild1);
return treeElement;
}
function addTreeItemToTreeChild(treeChild,label,value,addTwistie)
function addTreeItemToTreeChild(treeChild, label, value, addTwistie)
{
var treeElem1 = document.createElement("treeitem");
let treeElem1 = document.createElement("treeitem");
if (addTwistie) {
treeElem1.setAttribute("container","true");
treeElem1.setAttribute("open","true");
treeElem1.setAttribute("container", "true");
treeElem1.setAttribute("open", "true");
}
var treeRow = document.createElement("treerow");
var treeCell = document.createElement("treecell");
treeCell.setAttribute("label",label);
let treeRow = document.createElement("treerow");
let treeCell = document.createElement("treecell");
treeCell.setAttribute("label", label);
if (value) {
treeCell.setAttribute("display",value);
treeCell.setAttribute("display", value);
}
treeRow.appendChild(treeCell);
treeElem1.appendChild(treeRow);
@ -163,12 +174,12 @@ listener.prototype.QueryInterface =
}
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
listener.prototype.notify =
function(cert, result) {
DisplayVerificationData(cert, result);
}
};
function DisplayVerificationData(cert, result)
{
@ -221,38 +232,31 @@ function DisplayVerificationData(cert, result)
if (count > 0) {
var verifyInfoBox = document.getElementById('verify_info_box');
for (let i = 0; i < count; i++) {
AddUsage(usageList[i],verifyInfoBox);
AddUsage(usageList[i], verifyInfoBox);
}
}
}
/**
* Displays information about a cert in the "General" tab of the cert viewer.
*
* @param {nsIX509Cert} cert
* Cert to display information about.
*/
function DisplayGeneralDataFromCert(cert)
{
// Common Name
addAttributeFromCert('commonname', cert.commonName);
// Organization
addAttributeFromCert('organization', cert.organization);
// Organizational Unit
addAttributeFromCert('orgunit', cert.organizationalUnit);
// Serial Number
addAttributeFromCert('serialnumber',cert.serialNumber);
// SHA-256 Fingerprint
addAttributeFromCert('sha256fingerprint', cert.sha256Fingerprint);
// SHA1 Fingerprint
addAttributeFromCert('sha1fingerprint',cert.sha1Fingerprint);
// Validity start
addAttributeFromCert('validitystart', cert.validity.notBeforeLocalDay);
// Validity end
addAttributeFromCert('validityend', cert.validity.notAfterLocalDay);
addAttributeFromCert("commonname", cert.commonName);
addAttributeFromCert("organization", cert.organization);
addAttributeFromCert("orgunit", cert.organizationalUnit);
addAttributeFromCert("serialnumber", cert.serialNumber);
addAttributeFromCert("sha256fingerprint", cert.sha256Fingerprint);
addAttributeFromCert("sha1fingerprint", cert.sha1Fingerprint);
addAttributeFromCert("validitystart", cert.validity.notBeforeLocalDay);
addAttributeFromCert("validityend", cert.validity.notAfterLocalDay);
//Now to populate the fields that correspond to the issuer.
var issuerCommonname, issuerOrg, issuerOrgUnit;
issuerCommonname = cert.issuerCommonName;
issuerOrg = cert.issuerOrganization;
issuerOrgUnit = cert.issuerOrganizationUnit;
addAttributeFromCert('issuercommonname', issuerCommonname);
addAttributeFromCert('issuerorganization', issuerOrg);
addAttributeFromCert('issuerorgunit', issuerOrgUnit);
addAttributeFromCert("issuercommonname", cert.issuerCommonName);
addAttributeFromCert("issuerorganization", cert.issuerOrganization);
addAttributeFromCert("issuerorgunit", cert.issuerOrganizationUnit);
}
function updateCertDump()

Просмотреть файл

@ -23,7 +23,7 @@ FakeSSLStatus.prototype = {
}
throw Components.results.NS_ERROR_NO_INTERFACE;
},
}
};
// This is a template to help porting global private browsing tests
// to per-window private browsing tests

Просмотреть файл

@ -11,8 +11,8 @@
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
.goBack();
}, 100);
}
};
</script>
</head>
</html>

Просмотреть файл

@ -13,7 +13,7 @@
window.location =
"https://example.com/tests/security/manager/ssl/tests/mochitest/mixedcontent/bug383369step3.html?runtest";
}, 0);
}
};
function afterNavigationTest()
{

Просмотреть файл

@ -47,7 +47,7 @@ window.onload = function onLoad() {
let secureTestLocation = loadAsInsecure ? "http://example.com"
: "https://example.com";
secureTestLocation += location.pathname
secureTestLocation += location.pathname;
if (testPage != "") {
array = secureTestLocation.split("/");
array.pop();
@ -70,7 +70,7 @@ window.onload = function onLoad() {
window.open(secureTestLocation);
}
}
}
};
function onMessageReceived(event)
{

Просмотреть файл

@ -85,7 +85,7 @@
prefs.clearUserPref(prefKey);
}
}
}
};
</script>
</head>

Просмотреть файл

@ -22,7 +22,7 @@
var img1 = document.getElementById("img1");
img1.addEventListener("load", onLoadFunction, false);
img1.src = "https://example.com/tests/security/manager/ssl/tests/mochitest/mixedcontent/moonsurface.jpg";
}
};
function runTest()
{
@ -35,7 +35,7 @@
isSecurityState("secure", "secure after navigation");
finish();
}
</script>
</head>

Просмотреть файл

@ -22,7 +22,7 @@
iframe.onload = function() {
self.isSecurityState("broken", "src='redirect to unsecure' changed to broken");
self.finish();
}
};
iframe.src =
"https://example.com/tests/security/manager/ssl/tests/mochitest/mixedcontent/iframeunsecredirect.sjs";

Просмотреть файл

@ -195,7 +195,7 @@
function clean_up_sts_state(isPrivate) {
// erase all signs that this test ran.
SimpleTest.info("Cleaning up STS data");
var flags = isPrivate ? Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0
let flags = isPrivate ? Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0;
SpecialPowers.cleanUpSTSData("http://example.com", flags);
dump_STSState(isPrivate);
}
@ -204,7 +204,7 @@
var sss =
Cc["@mozilla.org/ssservice;1"].
getService(Ci.nsISiteSecurityService);
var flags = isPrivate ? Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0
let flags = isPrivate ? Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0;
SimpleTest.info("State of example.com: " + sss.isSecureHost(Ci.nsISiteSecurityService.HEADER_HSTS, "example.com", flags));
}
@ -224,7 +224,7 @@
];
function finish() {
SpecialPowers.Services.prefs.clearUserPref("browser.startup.page")
SpecialPowers.Services.prefs.clearUserPref("browser.startup.page");
SimpleTest.finish();
}
function nextTest() {

Просмотреть файл

@ -565,7 +565,7 @@ function startOCSPResponder(serverPort, identity, invalidIdentities,
function handleServerCallback(aRequest, aResponse) {
invalidIdentities.forEach(function(identity) {
Assert.notEqual(aRequest.host, identity,
"Request host and invalid identity should not match")
"Request host and invalid identity should not match");
});
do_print("got request for: " + aRequest.path);
let basePath = aRequest.path.slice(1).split("/")[0];
@ -633,7 +633,7 @@ FakeSSLStatus.prototype = {
}
throw Components.results.NS_ERROR_NO_INTERFACE;
},
}
};
// Utility functions for adding tests relating to certificate error overrides

Просмотреть файл

@ -90,7 +90,7 @@ var revocations = profile.clone();
revocations.append("revocations.txt");
if (!revocations.exists()) {
let existing = do_get_file("test_onecrl/sample_revocations.txt", false);
existing.copyTo(profile,"revocations.txt");
existing.copyTo(profile, "revocations.txt");
}
var certDB = Cc["@mozilla.org/security/x509certdb;1"]
@ -139,13 +139,13 @@ var updatedBlocklist = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<certItems>" +
"<certItem issuerName='something new in both the issuer'>" +
"<serialNumber>and the serial number</serialNumber></certItem>" +
"</certItems></blocklist>"
"</certItems></blocklist>";
var blocklists = {
"/initialBlocklist/" : initialBlocklist,
"/updatedBlocklist/" : updatedBlocklist
}
};
function serveResponse(request, response) {
do_print("Serving for path " + request.path + "\n");
@ -211,7 +211,7 @@ function fetch_blocklist(blocklistPath) {
Services.obs.removeObserver(this, "blocklist-updated");
run_next_test();
}
}
};
Services.obs.addObserver(certblockObserver, "blocklist-updated", false);
Services.prefs.setCharPref("extensions.blocklist.url",
@ -228,7 +228,7 @@ function check_revocations_txt_contents(expected) {
ok(revocations.exists(), "the revocations file should exist");
let inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
inputStream.init(revocations,-1, -1, 0);
inputStream.init(revocations, -1, -1, 0);
inputStream.QueryInterface(Ci.nsILineInputStream);
let contents = "";
let hasmore = false;

Просмотреть файл

@ -73,7 +73,7 @@ function run_port_equivalency_test(inPort, outPort) {
let certOverrideService = Cc["@mozilla.org/security/certoverride;1"]
.getService(Ci.nsICertOverrideService);
let cert = constructCertFromFile("bad_certs/default-ee.pem");
let expectedBits = Ci.nsICertOverrideService.ERROR_UNTRUSTED
let expectedBits = Ci.nsICertOverrideService.ERROR_UNTRUSTED;
let expectedTemporary = true;
certOverrideService.rememberValidityOverride("example.com", inPort, cert,
expectedBits, expectedTemporary);

Просмотреть файл

@ -29,7 +29,7 @@ function testGood(data) {
equal(cert.commonName, data.cn,
"Actual and expected commonName should match");
} catch (e) {
do_print(`Exception: ${excMessage(e)}`)
do_print(`Exception: ${excMessage(e)}`);
ok(false, `Should not have gotten an exception for "CN=${data.cn}"`);
}
}

Просмотреть файл

@ -135,7 +135,7 @@ function run_test() {
// Testing on a non constrainted root an intermediate name contrainted to
// permited dirNAME:C=US and permited DNS:foo.com
// checks for compostability of different name constraints with same cert
check_ok_ca(load_cert('int-nc-perm-foo.com_c-us-ca-nc' , ',,'));
check_ok_ca(load_cert('int-nc-perm-foo.com_c-us-ca-nc', ',,'));
check_fail(certFromFile('cn-www.foo.com-int-nc-perm-foo.com_c-us-ca-nc'));
check_fail(certFromFile('cn-www.foo.org-int-nc-perm-foo.com_c-us-ca-nc'));
check_fail(certFromFile('cn-www.foo.com-alt-foo.org-int-nc-perm-foo.com_c-us-ca-nc'));

Просмотреть файл

@ -75,7 +75,7 @@ function checkPassRemovingPin(pinValue) {
const NON_ISSUED_KEY_HASH1 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
const NON_ISSUED_KEY_HASH2 = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ=";
const PINNING_ROOT_KEY_HASH = "VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=";
const MAX_AGE_ZERO = "max-age=0;"
const MAX_AGE_ZERO = "max-age=0;";
const VALID_PIN1 = `pin-sha256="${PINNING_ROOT_KEY_HASH}";`;
const BACKUP_PIN1 = `pin-sha256="${NON_ISSUED_KEY_HASH1}";`;
const BACKUP_PIN2 = `pin-sha256="${NON_ISSUED_KEY_HASH2}";`;

Просмотреть файл

@ -109,7 +109,7 @@ function truncateEntry(entry, entryInput) {
.createInstance(Ci.nsIStringInputStream);
content.data = "";
return [entry, content]
return [entry, content];
}
function run_test() {

Просмотреть файл

@ -94,7 +94,7 @@ add_test(function() {
add_test(function() {
verifyDirAsync("'two rsa files'", Cr.NS_ERROR_SIGNED_JAR_MANIFEST_INVALID,
{copy: [["META-INF/mozilla.rsa","extra.rsa"]]});
{copy: [["META-INF/mozilla.rsa", "extra.rsa"]]});
});
add_test(function() {
@ -114,12 +114,12 @@ add_test(function() {
add_test(function() {
verifyDirAsync("'extra .sf file (invalid)'", Cr.NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY,
{copy: [["META-INF/mozilla.rsa","extra.sf"]]});
{copy: [["META-INF/mozilla.rsa", "extra.sf"]]});
});
add_test(function() {
verifyDirAsync("'extra .sf file (valid)'", Cr.NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY,
{copy: [["META-INF/mozilla.sf","extra.sf"]]});
{copy: [["META-INF/mozilla.sf", "extra.sf"]]});
});
add_test(function() {
@ -144,7 +144,7 @@ add_test(function() {
add_test(function() {
verifyDirAsync("'extra file'", Cr.NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY,
{copy: [["bootstrap.js","extra"]]});
{copy: [["bootstrap.js", "extra"]]});
});
add_test(function() {
@ -159,7 +159,7 @@ add_test(function() {
add_test(function() {
verifyDirAsync("'extra file in dir'", Cr.NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY,
{copy: [["content/options.xul","extra"]]});
{copy: [["content/options.xul", "extra"]]});
});
do_register_cleanup(function() {

Просмотреть файл

@ -17,7 +17,7 @@ function check_ip(s, v, ip) {
let parsedMaxAge = {};
let parsedIncludeSubdomains = {};
s.processHeader(Ci.nsISiteSecurityService.HEADER_HSTS, uri,
"max-age=1000;includeSubdomains", sslStatus , 0,
"max-age=1000;includeSubdomains", sslStatus, 0,
parsedMaxAge, parsedIncludeSubdomains);
/* Test that processHeader will ignore headers for an uri, if the uri

Просмотреть файл

@ -52,7 +52,7 @@ function getReportCheck(expectReport, expectedError) {
});
reporter.reportTLSError(transportSecurityInfo, "example.com", -1);
}
};
}
// read the request body from a request

Просмотреть файл

@ -428,7 +428,7 @@ function nameToAlias(certName) {
// remove non-ascii characters
certName = certName.replace(/[^[:ascii:]]/g, "_");
// replace non word characters
certName = certName.replace(/[^A-Za-z0-9]/g ,"_");
certName = certName.replace(/[^A-Za-z0-9]/g, "_");
return "k" + certName + "Fingerprint";
}

Просмотреть файл

@ -238,7 +238,7 @@ writeTrustAnchors(trustAnchorsFile);
gTrustAnchors.roots.sort(function(a, b) {
// We need to work from the binary values, not the base64 values.
let aBin = atob(a.sha256Fingerprint);
let bBin = atob(b.sha256Fingerprint)
let bBin = atob(b.sha256Fingerprint);
if (aBin < bBin) {
return -1;