зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1324184 - Enable "no-tabs", "no-template-curly-in-string" and "quotes" ESLint rules for PSM. r=keeler
Also sorts the rule list alphabetically. MozReview-Commit-ID: 9LwgwfiViom --HG-- extra : rebase_source : 4fb1e49f3c3d9fe363654d0b7398f2088a7e3aea
This commit is contained in:
Родитель
ab062f5a9c
Коммит
9e010f1049
|
@ -84,12 +84,6 @@ module.exports = { // eslint-disable-line no-undef
|
|||
// No duplicate cases in switch statements
|
||||
"no-duplicate-case": "error",
|
||||
|
||||
// Disallow use of eval().
|
||||
"no-eval": "error",
|
||||
|
||||
// No labels
|
||||
"no-labels": "error",
|
||||
|
||||
// If an if block ends with a return no need for an else block
|
||||
"no-else-return": "error",
|
||||
|
||||
|
@ -99,6 +93,9 @@ module.exports = { // eslint-disable-line no-undef
|
|||
// Disallow empty destructuring
|
||||
"no-empty-pattern": "error",
|
||||
|
||||
// Disallow use of eval().
|
||||
"no-eval": "error",
|
||||
|
||||
// No assigning to exception variable
|
||||
"no-ex-assign": "error",
|
||||
|
||||
|
@ -120,6 +117,9 @@ module.exports = { // eslint-disable-line no-undef
|
|||
// No odd whitespace characters
|
||||
"no-irregular-whitespace": "error",
|
||||
|
||||
// No labels.
|
||||
"no-labels": "error",
|
||||
|
||||
// No single if block inside an else block
|
||||
"no-lonely-if": "error",
|
||||
|
||||
|
@ -164,6 +164,12 @@ module.exports = { // eslint-disable-line no-undef
|
|||
// Disallow sparse arrays, eg. let arr = [,,"error"].
|
||||
"no-sparse-arrays": "error",
|
||||
|
||||
// Disallow tabs.
|
||||
"no-tabs": "error",
|
||||
|
||||
// Disallow template literal placeholder syntax in regular strings.
|
||||
"no-template-curly-in-string": "error",
|
||||
|
||||
// Disallow throwing literals (eg. |throw "error"| instead of
|
||||
// |throw new Error("error")|)
|
||||
"no-throw-literal": "error",
|
||||
|
@ -186,6 +192,10 @@ module.exports = { // eslint-disable-line no-undef
|
|||
// No using with
|
||||
"no-with": "error",
|
||||
|
||||
// Require double quote strings to be used, except cases where another quote
|
||||
// type is used to avoid escaping.
|
||||
"quotes": ["error", "double", { "avoidEscape": true }],
|
||||
|
||||
// Always require semicolon at end of statement
|
||||
"semi": ["error", "always"],
|
||||
|
||||
|
|
|
@ -79,27 +79,27 @@ function LoadCerts()
|
|||
caTreeView = Components.classes[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
|
||||
document.getElementById('ca-tree').view = caTreeView;
|
||||
document.getElementById("ca-tree").view = caTreeView;
|
||||
|
||||
serverTreeView = Components.classes[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
serverTreeView.loadCertsFromCache(certcache, nsIX509Cert.SERVER_CERT);
|
||||
document.getElementById('server-tree').view = serverTreeView;
|
||||
document.getElementById("server-tree").view = serverTreeView;
|
||||
|
||||
emailTreeView = Components.classes[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
emailTreeView.loadCertsFromCache(certcache, nsIX509Cert.EMAIL_CERT);
|
||||
document.getElementById('email-tree').view = emailTreeView;
|
||||
document.getElementById("email-tree").view = emailTreeView;
|
||||
|
||||
userTreeView = Components.classes[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
userTreeView.loadCertsFromCache(certcache, nsIX509Cert.USER_CERT);
|
||||
document.getElementById('user-tree').view = userTreeView;
|
||||
document.getElementById("user-tree").view = userTreeView;
|
||||
|
||||
orphanTreeView = Components.classes[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
orphanTreeView.loadCertsFromCache(certcache, nsIX509Cert.UNKNOWN_CERT);
|
||||
document.getElementById('orphan-tree').view = orphanTreeView;
|
||||
document.getElementById("orphan-tree").view = orphanTreeView;
|
||||
|
||||
enableBackupAllButton();
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ function restoreCerts()
|
|||
// If this is an X509 user certificate, import it as one.
|
||||
|
||||
var isX509FileType = false;
|
||||
var fileTypesList = gCertFileTypes.slice(1).split('; *');
|
||||
var fileTypesList = gCertFileTypes.slice(1).split("; *");
|
||||
for (var type of fileTypesList) {
|
||||
if (fp.file.path.endsWith(type)) {
|
||||
isX509FileType = true;
|
||||
|
@ -532,8 +532,8 @@ function addEmailCert()
|
|||
|
||||
function addException()
|
||||
{
|
||||
window.openDialog('chrome://pippki/content/exceptionDialog.xul', "",
|
||||
'chrome,centerscreen,modal');
|
||||
window.openDialog("chrome://pippki/content/exceptionDialog.xul", "",
|
||||
"chrome,centerscreen,modal");
|
||||
var certcache = certdb.getCerts();
|
||||
serverTreeView.loadCertsFromCache(certcache, nsIX509Cert.SERVER_CERT);
|
||||
serverTreeView.selection.clearSelection();
|
||||
|
|
|
@ -251,10 +251,10 @@ function addTreeItemToTreeChild(treeChild, label, value, addTwistie)
|
|||
}
|
||||
|
||||
function displaySelected() {
|
||||
var asn1Tree = document.getElementById('prettyDumpTree')
|
||||
var asn1Tree = document.getElementById("prettyDumpTree")
|
||||
.view.QueryInterface(nsIASN1Tree);
|
||||
var items = asn1Tree.selection;
|
||||
var certDumpVal = document.getElementById('certDumpVal');
|
||||
var certDumpVal = document.getElementById("certDumpVal");
|
||||
if (items.currentIndex != -1) {
|
||||
var value = asn1Tree.getDisplayData(items.currentIndex);
|
||||
certDumpVal.value = value;
|
||||
|
@ -268,16 +268,16 @@ function BuildPrettyPrint(cert)
|
|||
var certDumpTree = Components.classes[nsASN1Tree].
|
||||
createInstance(nsIASN1Tree);
|
||||
certDumpTree.loadASN1Structure(cert.ASN1Structure);
|
||||
document.getElementById('prettyDumpTree').view = certDumpTree;
|
||||
document.getElementById("prettyDumpTree").view = certDumpTree;
|
||||
}
|
||||
|
||||
function addAttributeFromCert(nodeName, value)
|
||||
{
|
||||
var node = document.getElementById(nodeName);
|
||||
if (!value) {
|
||||
value = bundle.getString('notPresent');
|
||||
value = bundle.getString("notPresent");
|
||||
}
|
||||
node.setAttribute('value', value);
|
||||
node.setAttribute("value", value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -304,15 +304,15 @@ function DisplayGeneralDataFromCert(cert)
|
|||
|
||||
function updateCertDump()
|
||||
{
|
||||
var asn1Tree = document.getElementById('prettyDumpTree')
|
||||
var asn1Tree = document.getElementById("prettyDumpTree")
|
||||
.view.QueryInterface(nsIASN1Tree);
|
||||
|
||||
var tree = document.getElementById('treesetDump');
|
||||
var tree = document.getElementById("treesetDump");
|
||||
if (tree.currentIndex < 0) {
|
||||
doPrompt("No items are selected."); //This should never happen.
|
||||
} else {
|
||||
var item = tree.contentView.getItemAtIndex(tree.currentIndex);
|
||||
var dbKey = item.firstChild.firstChild.getAttribute('display');
|
||||
var dbKey = item.firstChild.firstChild.getAttribute("display");
|
||||
// Get the cert from the cert database
|
||||
var certdb = Components.classes[nsX509CertDB].getService(nsIX509CertDB);
|
||||
var cert = certdb.findCertByDBKey(dbKey);
|
||||
|
@ -324,9 +324,9 @@ function updateCertDump()
|
|||
function getCurrentCert()
|
||||
{
|
||||
var realIndex;
|
||||
var tree = document.getElementById('treesetDump');
|
||||
var tree = document.getElementById("treesetDump");
|
||||
if (tree.view.selection.isSelected(tree.currentIndex)
|
||||
&& document.getElementById('prettyprint_tab').selected) {
|
||||
&& document.getElementById("prettyprint_tab").selected) {
|
||||
/* if the user manually selected a cert on the Details tab,
|
||||
then take that one */
|
||||
realIndex = tree.currentIndex;
|
||||
|
@ -338,7 +338,7 @@ function getCurrentCert()
|
|||
}
|
||||
if (realIndex >= 0) {
|
||||
var item = tree.contentView.getItemAtIndex(realIndex);
|
||||
var dbKey = item.firstChild.firstChild.getAttribute('display');
|
||||
var dbKey = item.firstChild.firstChild.getAttribute("display");
|
||||
var certdb = Components.classes[nsX509CertDB].getService(nsIX509CertDB);
|
||||
var cert = certdb.findCertByDBKey(dbKey);
|
||||
return cert;
|
||||
|
|
|
@ -106,7 +106,7 @@ function process()
|
|||
}
|
||||
|
||||
// Select first password field
|
||||
document.getElementById('pw1').focus();
|
||||
document.getElementById("pw1").focus();
|
||||
} else {
|
||||
// Select old password field
|
||||
oldpwbox.setAttribute("hidden", "false");
|
||||
|
|
|
@ -144,7 +144,7 @@ var selected_module;
|
|||
/* get the slot selected by the user (can only be one-at-a-time) */
|
||||
function getSelectedItem()
|
||||
{
|
||||
var tree = document.getElementById('device_tree');
|
||||
var tree = document.getElementById("device_tree");
|
||||
if (tree.currentIndex < 0) return;
|
||||
var item = tree.contentView.getItemAtIndex(tree.currentIndex);
|
||||
selected_slot = null;
|
||||
|
@ -202,17 +202,14 @@ function enableButtons()
|
|||
}
|
||||
showSlotInfo();
|
||||
}
|
||||
var thebutton = document.getElementById('login_button');
|
||||
thebutton.setAttribute("disabled", login_toggle);
|
||||
thebutton = document.getElementById('logout_button');
|
||||
thebutton.setAttribute("disabled", logout_toggle);
|
||||
thebutton = document.getElementById('change_pw_button');
|
||||
thebutton.setAttribute("disabled", pw_toggle);
|
||||
thebutton = document.getElementById('unload_button');
|
||||
thebutton.setAttribute("disabled", unload_toggle);
|
||||
// not implemented
|
||||
//thebutton = document.getElementById('change_slotname_button');
|
||||
//thebutton.setAttribute("disabled", toggle);
|
||||
document.getElementById("login_button")
|
||||
.setAttribute("disabled", login_toggle);
|
||||
document.getElementById("logout_button")
|
||||
.setAttribute("disabled", logout_toggle);
|
||||
document.getElementById("change_pw_button")
|
||||
.setAttribute("disabled", pw_toggle);
|
||||
document.getElementById("unload_button")
|
||||
.setAttribute("disabled", unload_toggle);
|
||||
}
|
||||
|
||||
// clear the display of information for the slot
|
||||
|
@ -229,7 +226,7 @@ function ClearDeviceList()
|
|||
ClearInfoList();
|
||||
|
||||
skip_enable_buttons = true;
|
||||
var tree = document.getElementById('device_tree');
|
||||
var tree = document.getElementById("device_tree");
|
||||
tree.view.selection.clearSelection();
|
||||
skip_enable_buttons = false;
|
||||
|
||||
|
@ -402,7 +399,7 @@ function doUnload()
|
|||
// handle card insertion and removal
|
||||
function onSmartCardChange()
|
||||
{
|
||||
var tree = document.getElementById('device_tree');
|
||||
var tree = document.getElementById("device_tree");
|
||||
var index = tree.currentIndex;
|
||||
tree.currentIndex = 0;
|
||||
ClearDeviceList();
|
||||
|
|
|
@ -63,7 +63,7 @@ function initExceptionDialog() {
|
|||
if (args[0].location) {
|
||||
// We were pre-seeded with a location.
|
||||
document.getElementById("locationTextBox").value = args[0].location;
|
||||
document.getElementById('checkCertButton').disabled = false;
|
||||
document.getElementById("checkCertButton").disabled = false;
|
||||
|
||||
if (args[0].sslStatus) {
|
||||
gSSLStatus = args[0].sslStatus;
|
||||
|
@ -106,7 +106,7 @@ function checkCert() {
|
|||
var req = new XMLHttpRequest();
|
||||
try {
|
||||
if (uri) {
|
||||
req.open('GET', uri.prePath, false);
|
||||
req.open("GET", uri.prePath, false);
|
||||
req.channel.notificationCallbacks = new badCertListener();
|
||||
req.send(null);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ function resetDialog() {
|
|||
* Called by input textboxes to manage UI state
|
||||
*/
|
||||
function handleTextChange() {
|
||||
var checkCertButton = document.getElementById('checkCertButton');
|
||||
var checkCertButton = document.getElementById("checkCertButton");
|
||||
checkCertButton.disabled = !(document.getElementById("locationTextBox").value);
|
||||
if (gNeedReset) {
|
||||
gNeedReset = false;
|
||||
|
|
|
@ -37,7 +37,7 @@ function getDERString(cert)
|
|||
{
|
||||
var length = {};
|
||||
var derArray = cert.getRawDER(length);
|
||||
var derString = '';
|
||||
var derString = "";
|
||||
for (var i = 0; i < derArray.length; i++) {
|
||||
derString += String.fromCharCode(derArray[i]);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ function getPKCS7String(cert, chainMode)
|
|||
{
|
||||
var length = {};
|
||||
var pkcs7Array = cert.exportAsCMS(chainMode, length);
|
||||
var pkcs7String = '';
|
||||
var pkcs7String = "";
|
||||
for (var i = 0; i < pkcs7Array.length; i++) {
|
||||
pkcs7String += String.fromCharCode(pkcs7Array[i]);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ function exportToFile(parent, cert)
|
|||
return;
|
||||
}
|
||||
|
||||
var content = '';
|
||||
var content = "";
|
||||
switch (fp.filterIndex) {
|
||||
case 1:
|
||||
content = getPEMString(cert);
|
||||
|
|
|
@ -14,39 +14,45 @@
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const STSPATH = "/tests/security/manager/ssl/tests/mochitest/stricttransportsecurity";
|
||||
const STSPATH =
|
||||
"tests/security/manager/ssl/tests/mochitest/stricttransportsecurity";
|
||||
|
||||
// initialized manually here
|
||||
var testsleft = {'plain': 4, 'subdom': 4};
|
||||
var testsleft = {plain: 4, subdom: 4};
|
||||
var roundsLeft = 2;
|
||||
|
||||
var testframes = {
|
||||
'samedom':
|
||||
{'url': "http://example.com" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'SECURE', 'subdom': 'SECURE'}},
|
||||
'subdom':
|
||||
{'url': "http://test1.example.com" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'INSECURE', 'subdom': 'SECURE'}},
|
||||
'otherdom':
|
||||
{'url': "http://example.org" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'INSECURE', 'subdom': 'INSECURE'}},
|
||||
'alreadysecure':
|
||||
{'url': "https://test2.example.com" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'SECURE', 'subdom': 'SECURE'}},
|
||||
samedom: {
|
||||
url: `http://example.com/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "SECURE", subdom: "SECURE"}
|
||||
},
|
||||
subdom: {
|
||||
url: `http://test1.example.com/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "INSECURE", subdom: "SECURE"}
|
||||
},
|
||||
otherdom: {
|
||||
url: `http://example.org/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "INSECURE", subdom: "INSECURE"}
|
||||
},
|
||||
alreadysecure: {
|
||||
url: `https://test2.example.com/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "SECURE", subdom: "SECURE"}
|
||||
},
|
||||
};
|
||||
|
||||
function startRound(round) {
|
||||
let frame = document.createElement("iframe");
|
||||
frame.setAttribute('id', 'ifr_bootstrap');
|
||||
frame.setAttribute('src', "https://example.com" + STSPATH + "/" + round + "_bootstrap.html");
|
||||
frame.setAttribute("id", "ifr_bootstrap");
|
||||
frame.setAttribute("src",
|
||||
`https://example.com/${STSPATH}/${round}_bootstrap.html`);
|
||||
document.body.appendChild(frame);
|
||||
}
|
||||
|
||||
function endRound(round) {
|
||||
// remove all the iframes in the document
|
||||
document.body.removeChild(document.getElementById('ifr_bootstrap'));
|
||||
document.body.removeChild(document.getElementById("ifr_bootstrap"));
|
||||
for (let test in testframes) {
|
||||
document.body.removeChild(document.getElementById('ifr_' + test));
|
||||
document.body.removeChild(document.getElementById("ifr_" + test));
|
||||
}
|
||||
|
||||
// clean up the STS state
|
||||
|
@ -56,8 +62,8 @@
|
|||
function loadVerifyFrames(round) {
|
||||
for (let test in testframes) {
|
||||
let frame = document.createElement("iframe");
|
||||
frame.setAttribute('id', 'ifr_' + test);
|
||||
frame.setAttribute('src', testframes[test].url + '?id=' + test);
|
||||
frame.setAttribute("id", "ifr_" + test);
|
||||
frame.setAttribute("src", testframes[test].url + "?id=" + test);
|
||||
document.body.appendChild(frame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const STSPATH = "/tests/security/manager/ssl/tests/mochitest/stricttransportsecurity";
|
||||
const STSPATH =
|
||||
"tests/security/manager/ssl/tests/mochitest/stricttransportsecurity";
|
||||
const NUM_TEST_FRAMES = 4;
|
||||
const CONTENT_PAGE =
|
||||
"http://mochi.test:8888/chrome/security/manager/ssl/tests/mochitest/stricttransportsecurity/page_blank.html";
|
||||
|
@ -44,26 +45,22 @@
|
|||
SpecialPowers.Services.prefs.setIntPref("browser.startup.page", 0);
|
||||
|
||||
var testframes = {
|
||||
'samedom':
|
||||
{'url': "http://example.com" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'SECURE',
|
||||
'subdom': 'SECURE',
|
||||
'nosts': 'INSECURE'}},
|
||||
'subdom':
|
||||
{'url': "http://test1.example.com" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'INSECURE',
|
||||
'subdom': 'SECURE',
|
||||
'nosts': 'INSECURE'}},
|
||||
'otherdom':
|
||||
{'url': "http://example.org" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'INSECURE',
|
||||
'subdom': 'INSECURE',
|
||||
'nosts': 'INSECURE'}},
|
||||
'alreadysecure':
|
||||
{'url': "https://test2.example.com" + STSPATH + "/verify.sjs",
|
||||
'expected': {'plain': 'SECURE',
|
||||
'subdom': 'SECURE',
|
||||
'nosts': 'SECURE'}},
|
||||
samedom: {
|
||||
url: `http://example.com/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "SECURE", subdom: "SECURE", nosts: "INSECURE"}
|
||||
},
|
||||
subdom: {
|
||||
url: `http://test1.example.com/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "INSECURE", subdom: "SECURE", nosts: "INSECURE"}
|
||||
},
|
||||
otherdom: {
|
||||
url: `http://example.org/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "INSECURE", subdom: "INSECURE", nosts: "INSECURE"}
|
||||
},
|
||||
alreadysecure: {
|
||||
url: `https://test2.example.com/${STSPATH}/verify.sjs`,
|
||||
expected: {plain: "SECURE", subdom: "SECURE", nosts: "SECURE"}
|
||||
},
|
||||
};
|
||||
|
||||
function whenDelayedStartupFinished(aWindow, aCallback) {
|
||||
|
@ -95,12 +92,12 @@
|
|||
SimpleTest.info("TESTS LEFT IN ROUND " + currentround + ": " + testsleftinround);
|
||||
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
let src = "https://example.com" + STSPATH + "/" + round + "_bootstrap.html";
|
||||
let src = `https://example.com/${STSPATH}/${round}_bootstrap.html`;
|
||||
|
||||
ContentTask.spawn(browser, src, function* (contentSrc) {
|
||||
let frame = content.document.createElement("iframe");
|
||||
frame.setAttribute('id', 'ifr_bootstrap');
|
||||
frame.setAttribute('src', contentSrc);
|
||||
frame.setAttribute("id", "ifr_bootstrap");
|
||||
frame.setAttribute("src", contentSrc);
|
||||
|
||||
return new Promise(resolve => {
|
||||
frame.addEventListener("load", resolve);
|
||||
|
@ -112,24 +109,24 @@
|
|||
}
|
||||
|
||||
function loadVerifyFrames(win, isPrivate, round) {
|
||||
loadVerifyFrame(win, isPrivate, testframes.samedom, 'samedom', function() {
|
||||
loadVerifyFrame(win, isPrivate, testframes.subdom, 'subdom', function() {
|
||||
loadVerifyFrame(win, isPrivate, testframes.otherdom, 'otherdom', function() {
|
||||
loadVerifyFrame(win, isPrivate, testframes.alreadysecure, 'alreadysecure');
|
||||
loadVerifyFrame(win, isPrivate, testframes.samedom, "samedom", function() {
|
||||
loadVerifyFrame(win, isPrivate, testframes.subdom, "subdom", function() {
|
||||
loadVerifyFrame(win, isPrivate, testframes.otherdom, "otherdom", function() {
|
||||
loadVerifyFrame(win, isPrivate, testframes.alreadysecure, "alreadysecure");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadVerifyFrame(win, isPrivate, test, testName, aCallback) {
|
||||
let id = 'ifr_' + testName;
|
||||
let src = test.url + '?id=' + testName;
|
||||
let id = "ifr_" + testName;
|
||||
let src = test.url + "?id=" + testName;
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
|
||||
ContentTask.spawn(browser, [id, src], function* ([contentId, contentSrc]) {
|
||||
let frame = content.document.createElement("iframe");
|
||||
frame.setAttribute('id', contentId);
|
||||
frame.setAttribute('src', contentSrc);
|
||||
frame.setAttribute("id", contentId);
|
||||
frame.setAttribute("src", contentSrc);
|
||||
|
||||
return new Promise(resolve => {
|
||||
frame.addEventListener("load", () => {
|
||||
|
@ -139,7 +136,7 @@
|
|||
content.document.body.appendChild(frame);
|
||||
});
|
||||
}).then(scheme => {
|
||||
if (scheme == 'https:') {
|
||||
if (scheme == "https:") {
|
||||
onMessageReceived(win, isPrivate, "SECURE " + testName);
|
||||
} else {
|
||||
onMessageReceived(win, isPrivate, "INSECURE " + testName);
|
||||
|
@ -184,10 +181,10 @@
|
|||
let browser = win.gBrowser.selectedBrowser;
|
||||
ContentTask.spawn(browser, testframes, function* (contentTestFrames) {
|
||||
content.document.body.removeChild(
|
||||
content.document.getElementById('ifr_bootstrap'));
|
||||
content.document.getElementById("ifr_bootstrap"));
|
||||
for (let test in contentTestFrames) {
|
||||
content.document.body.removeChild(
|
||||
content.document.getElementById('ifr_' + test));
|
||||
content.document.getElementById("ifr_" + test));
|
||||
}
|
||||
}).then(() => {
|
||||
currentround = "";
|
||||
|
@ -208,7 +205,7 @@
|
|||
testOnWindow(false, function(win) {
|
||||
SimpleTest.info("In public window");
|
||||
dump_STSState(false);
|
||||
startRound(win, false, 'plain');
|
||||
startRound(win, false, "plain");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -216,7 +213,7 @@
|
|||
testOnWindow(true, function(win) {
|
||||
SimpleTest.info("In private window");
|
||||
dump_STSState(true);
|
||||
startRound(win, true, 'subdom');
|
||||
startRound(win, true, "subdom");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -224,7 +221,7 @@
|
|||
testOnWindow(false, function(win) {
|
||||
SimpleTest.info("In a new public window");
|
||||
dump_STSState(false);
|
||||
startRound(win, false, 'nosts');
|
||||
startRound(win, false, "nosts");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -265,7 +262,7 @@
|
|||
function nextTest() {
|
||||
SimpleTest.executeSoon(tests.length ? tests.shift() : finish);
|
||||
}
|
||||
window.addEventListener('load', nextTest, false);
|
||||
window.addEventListener("load", nextTest, false);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
|
|
@ -146,17 +146,10 @@ function load_cert(cert, trust) {
|
|||
|
||||
function test_is_revoked(certList, issuerString, serialString, subjectString,
|
||||
pubKeyString) {
|
||||
let issuer = converter.convertToByteArray(issuerString ? issuerString : '',
|
||||
{});
|
||||
|
||||
let serial = converter.convertToByteArray(serialString ? serialString : '',
|
||||
{});
|
||||
|
||||
let subject = converter.convertToByteArray(subjectString ? subjectString : '',
|
||||
{});
|
||||
|
||||
let pubKey = converter.convertToByteArray(pubKeyString ? pubKeyString : '',
|
||||
{});
|
||||
let issuer = converter.convertToByteArray(issuerString || "", {});
|
||||
let serial = converter.convertToByteArray(serialString || "", {});
|
||||
let subject = converter.convertToByteArray(subjectString || "", {});
|
||||
let pubKey = converter.convertToByteArray(pubKeyString || "", {});
|
||||
|
||||
return certList.isCertRevoked(issuer,
|
||||
issuerString ? issuerString.length : 0,
|
||||
|
@ -291,7 +284,7 @@ function run_test() {
|
|||
|
||||
// test a subject / pubKey revocation
|
||||
ok(test_is_revoked(certList, "nonsense", "more nonsense",
|
||||
"some imaginary subject", "some imaginary pubkey"),
|
||||
"some imaginary subject", "some imaginary pubkey"),
|
||||
"issuer / serial pair should be blocked");
|
||||
|
||||
// Check the blocklist entry has been persisted properly to the backing
|
||||
|
|
|
@ -32,7 +32,7 @@ function test_cert_equals() {
|
|||
}
|
||||
|
||||
function test_cert_list_serialization() {
|
||||
let certList = build_cert_chain(['default-ee', 'expired-ee']);
|
||||
let certList = build_cert_chain(["default-ee", "expired-ee"]);
|
||||
|
||||
// Serialize the cert list to a string
|
||||
let serHelper = Cc["@mozilla.org/network/serialization-helper;1"]
|
||||
|
|
|
@ -25,9 +25,9 @@ function readAndTamperWithNthByte(certificatePath, n) {
|
|||
// remember, n is negative at this point
|
||||
n = der.length + n;
|
||||
}
|
||||
let replacement = '\x22';
|
||||
let replacement = "\x22";
|
||||
if (der.charCodeAt(n) == replacement) {
|
||||
replacement = '\x23';
|
||||
replacement = "\x23";
|
||||
}
|
||||
der = der.substring(0, n) + replacement + der.substring(n + 1);
|
||||
return btoa(der);
|
||||
|
|
|
@ -35,9 +35,9 @@ function loadChain(prefix, names) {
|
|||
|
||||
function run_test() {
|
||||
// set up some data
|
||||
const DATA = readFile(do_get_file(TEST_DATA_DIR + 'test.txt'));
|
||||
const DATA = readFile(do_get_file(TEST_DATA_DIR + "test.txt"));
|
||||
const GOOD_SIGNATURE = "p384ecdsa=" +
|
||||
readFile(do_get_file(TEST_DATA_DIR + 'test.txt.signature'))
|
||||
readFile(do_get_file(TEST_DATA_DIR + "test.txt.signature"))
|
||||
.trim();
|
||||
|
||||
const BAD_SIGNATURE = "p384ecdsa=WqRXFQ7tnlVufpg7A-ZavXvWd2Zln0o4woHBy26C2r" +
|
||||
|
@ -200,7 +200,7 @@ function run_test() {
|
|||
// ensure we test each bad section on its own...
|
||||
badChains.push(badSection);
|
||||
// ... and as part of a chain with good certificates
|
||||
badChains.push(badSection + '\n' + chainSuffix);
|
||||
badChains.push(badSection + "\n" + chainSuffix);
|
||||
}
|
||||
|
||||
for (let badChain of badChains) {
|
||||
|
|
|
@ -10,9 +10,9 @@ const certdb = Cc["@mozilla.org/security/x509certdb;1"]
|
|||
.getService(Ci.nsIX509CertDB);
|
||||
// This is the list of certificates needed for the test.
|
||||
var certList = [
|
||||
'ee',
|
||||
'ca-1',
|
||||
'ca-2',
|
||||
"ee",
|
||||
"ca-1",
|
||||
"ca-2",
|
||||
];
|
||||
|
||||
// Since all the ca's are identical expect for the serial number
|
||||
|
@ -24,7 +24,7 @@ function get_ca_array() {
|
|||
let enumerator = allCerts.getEnumerator();
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert);
|
||||
if (cert.commonName == 'ca') {
|
||||
if (cert.commonName == "ca") {
|
||||
ret_array[parseInt(cert.serialNumber, 16)] = cert;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ function doHash(algo, value, cmp) {
|
|||
|
||||
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = 'utf8';
|
||||
converter.charset = "utf8";
|
||||
value = converter.convertToByteArray(value);
|
||||
hash.update(value, value.length);
|
||||
equal(hexdigest(hash.finish(false)), cmp,
|
||||
|
@ -64,7 +64,7 @@ function doHashStream(algo, value, cmp) {
|
|||
|
||||
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = 'utf8';
|
||||
converter.charset = "utf8";
|
||||
let stream = converter.convertToInputStream(value);
|
||||
hash.updateFromStream(stream, stream.available());
|
||||
equal(hexdigest(hash.finish(false)), cmp,
|
||||
|
|
|
@ -31,8 +31,8 @@ function getHMAC(data, key, alg) {
|
|||
}
|
||||
|
||||
function testHMAC(alg) {
|
||||
const key1 = 'MyKey_ABCDEFGHIJKLMN';
|
||||
const key2 = 'MyKey_01234567890123';
|
||||
const key1 = "MyKey_ABCDEFGHIJKLMN";
|
||||
const key2 = "MyKey_01234567890123";
|
||||
|
||||
const dataA = "Secret message";
|
||||
const dataB = "Secres message";
|
||||
|
|
|
@ -29,8 +29,8 @@ function check_cert_err(cert_name, expected_error) {
|
|||
}
|
||||
|
||||
function run_test() {
|
||||
addCertFromFile(certdb, "test_ocsp_fetch_method/ca.pem", 'CTu,CTu,CTu');
|
||||
addCertFromFile(certdb, "test_ocsp_fetch_method/int.pem", ',,');
|
||||
addCertFromFile(certdb, "test_ocsp_fetch_method/ca.pem", "CTu,CTu,CTu");
|
||||
addCertFromFile(certdb, "test_ocsp_fetch_method/int.pem", ",,");
|
||||
|
||||
// Enabled so that we can force ocsp failure responses.
|
||||
Services.prefs.setBoolPref("security.OCSP.require", true);
|
||||
|
|
|
@ -31,8 +31,8 @@ function check_cert_err(cert_name, expected_error) {
|
|||
}
|
||||
|
||||
function run_test() {
|
||||
addCertFromFile(certdb, "test_ocsp_url/ca.pem", 'CTu,CTu,CTu');
|
||||
addCertFromFile(certdb, "test_ocsp_url/int.pem", ',,');
|
||||
addCertFromFile(certdb, "test_ocsp_url/ca.pem", "CTu,CTu,CTu");
|
||||
addCertFromFile(certdb, "test_ocsp_url/int.pem", ",,");
|
||||
|
||||
// Enabled so that we can force ocsp failure responses.
|
||||
Services.prefs.setBoolPref("security.OCSP.require", true);
|
||||
|
@ -97,7 +97,7 @@ function run_test() {
|
|||
|
||||
add_test(function() {
|
||||
clearOCSPCache();
|
||||
let ocspResponder = start_ocsp_responder(["no-path-url"], ['']);
|
||||
let ocspResponder = start_ocsp_responder(["no-path-url"], [""]);
|
||||
check_cert_err("no-path-url", PRErrorCodeSuccess);
|
||||
ocspResponder.stop(run_next_test);
|
||||
});
|
||||
|
|
|
@ -117,15 +117,23 @@ function checkStateRead(aSubject, aTopic, aData) {
|
|||
|
||||
// the written entry is for a.pinning2.example.com without subdomains
|
||||
// and b.pinning2.example.com with subdomains
|
||||
checkFail(certFromFile('a.pinning2.example.com-badca'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('a.pinning2.example.com-pinningroot'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-badca'), "x.a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-pinningroot'), "x.a.pinning2.example.com");
|
||||
checkFail(certFromFile("a.pinning2.example.com-badca"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("a.pinning2.example.com-pinningroot"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-badca"),
|
||||
"x.a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-pinningroot"),
|
||||
"x.a.pinning2.example.com");
|
||||
|
||||
checkFail(certFromFile('b.pinning2.example.com-badca'), "b.pinning2.example.com");
|
||||
checkOK(certFromFile('b.pinning2.example.com-pinningroot'), "b.pinning2.example.com");
|
||||
checkFail(certFromFile('x.b.pinning2.example.com-badca'), "x.b.pinning2.example.com");
|
||||
checkOK(certFromFile('x.b.pinning2.example.com-pinningroot'), "x.b.pinning2.example.com");
|
||||
checkFail(certFromFile("b.pinning2.example.com-badca"),
|
||||
"b.pinning2.example.com");
|
||||
checkOK(certFromFile("b.pinning2.example.com-pinningroot"),
|
||||
"b.pinning2.example.com");
|
||||
checkFail(certFromFile("x.b.pinning2.example.com-badca"),
|
||||
"x.b.pinning2.example.com");
|
||||
checkOK(certFromFile("x.b.pinning2.example.com-pinningroot"),
|
||||
"x.b.pinning2.example.com");
|
||||
|
||||
checkDefaultSiteHPKPStatus();
|
||||
|
||||
|
@ -134,14 +142,22 @@ function checkStateRead(aSubject, aTopic, aData) {
|
|||
gSSService.setKeyPins("a.pinning2.example.com", true,
|
||||
new Date().getTime() + 1000000, 2,
|
||||
[NON_ISSUED_KEY_HASH, PINNING_ROOT_KEY_HASH]);
|
||||
checkFail(certFromFile('a.pinning2.example.com-badca'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('a.pinning2.example.com-pinningroot'), "a.pinning2.example.com");
|
||||
checkFail(certFromFile('x.a.pinning2.example.com-badca'), "x.a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-pinningroot'), "x.a.pinning2.example.com");
|
||||
checkFail(certFromFile('b.pinning2.example.com-badca'), "b.pinning2.example.com");
|
||||
checkOK(certFromFile('b.pinning2.example.com-pinningroot'), "b.pinning2.example.com");
|
||||
checkFail(certFromFile('x.b.pinning2.example.com-badca'), "x.b.pinning2.example.com");
|
||||
checkOK(certFromFile('x.b.pinning2.example.com-pinningroot'), "x.b.pinning2.example.com");
|
||||
checkFail(certFromFile("a.pinning2.example.com-badca"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("a.pinning2.example.com-pinningroot"),
|
||||
"a.pinning2.example.com");
|
||||
checkFail(certFromFile("x.a.pinning2.example.com-badca"),
|
||||
"x.a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-pinningroot"),
|
||||
"x.a.pinning2.example.com");
|
||||
checkFail(certFromFile("b.pinning2.example.com-badca"),
|
||||
"b.pinning2.example.com");
|
||||
checkOK(certFromFile("b.pinning2.example.com-pinningroot"),
|
||||
"b.pinning2.example.com");
|
||||
checkFail(certFromFile("x.b.pinning2.example.com-badca"),
|
||||
"x.b.pinning2.example.com");
|
||||
checkOK(certFromFile("x.b.pinning2.example.com-pinningroot"),
|
||||
"x.b.pinning2.example.com");
|
||||
|
||||
ok(gSSService.isSecureHost(Ci.nsISiteSecurityService.HEADER_HPKP,
|
||||
"a.pinning2.example.com", 0),
|
||||
|
@ -156,15 +172,23 @@ function checkStateRead(aSubject, aTopic, aData) {
|
|||
gSSService.setKeyPins("a.pinning2.example.com", false,
|
||||
new Date().getTime() + 1000000, 2,
|
||||
[NON_ISSUED_KEY_HASH, PINNING_ROOT_KEY_HASH]);
|
||||
checkFail(certFromFile('a.pinning2.example.com-badca'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('a.pinning2.example.com-pinningroot'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-badca'), "x.a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-pinningroot'), "x.a.pinning2.example.com");
|
||||
checkFail(certFromFile("a.pinning2.example.com-badca"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("a.pinning2.example.com-pinningroot"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-badca"),
|
||||
"x.a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-pinningroot"),
|
||||
"x.a.pinning2.example.com");
|
||||
|
||||
checkFail(certFromFile('b.pinning2.example.com-badca'), "b.pinning2.example.com");
|
||||
checkOK(certFromFile('b.pinning2.example.com-pinningroot'), "b.pinning2.example.com");
|
||||
checkFail(certFromFile('x.b.pinning2.example.com-badca'), "x.b.pinning2.example.com");
|
||||
checkOK(certFromFile('x.b.pinning2.example.com-pinningroot'), "x.b.pinning2.example.com");
|
||||
checkFail(certFromFile("b.pinning2.example.com-badca"),
|
||||
"b.pinning2.example.com");
|
||||
checkOK(certFromFile("b.pinning2.example.com-pinningroot"),
|
||||
"b.pinning2.example.com");
|
||||
checkFail(certFromFile("x.b.pinning2.example.com-badca"),
|
||||
"x.b.pinning2.example.com");
|
||||
checkOK(certFromFile("x.b.pinning2.example.com-pinningroot"),
|
||||
"x.b.pinning2.example.com");
|
||||
|
||||
checkDefaultSiteHPKPStatus();
|
||||
|
||||
|
@ -173,15 +197,23 @@ function checkStateRead(aSubject, aTopic, aData) {
|
|||
gSSService.setKeyPins("a.pinning2.example.com", true,
|
||||
new Date().getTime() + 1000000, 1, ["not a hash"]);
|
||||
}, /NS_ERROR_ILLEGAL_VALUE/, "Attempting to set an invalid pin should fail");
|
||||
checkFail(certFromFile('a.pinning2.example.com-badca'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('a.pinning2.example.com-pinningroot'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-badca'), "x.a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-pinningroot'), "x.a.pinning2.example.com");
|
||||
checkFail(certFromFile("a.pinning2.example.com-badca"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("a.pinning2.example.com-pinningroot"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-badca"),
|
||||
"x.a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-pinningroot"),
|
||||
"x.a.pinning2.example.com");
|
||||
|
||||
checkFail(certFromFile('b.pinning2.example.com-badca'), "b.pinning2.example.com");
|
||||
checkOK(certFromFile('b.pinning2.example.com-pinningroot'), "b.pinning2.example.com");
|
||||
checkFail(certFromFile('x.b.pinning2.example.com-badca'), "x.b.pinning2.example.com");
|
||||
checkOK(certFromFile('x.b.pinning2.example.com-pinningroot'), "x.b.pinning2.example.com");
|
||||
checkFail(certFromFile("b.pinning2.example.com-badca"),
|
||||
"b.pinning2.example.com");
|
||||
checkOK(certFromFile("b.pinning2.example.com-pinningroot"),
|
||||
"b.pinning2.example.com");
|
||||
checkFail(certFromFile("x.b.pinning2.example.com-badca"),
|
||||
"x.b.pinning2.example.com");
|
||||
checkOK(certFromFile("x.b.pinning2.example.com-pinningroot"),
|
||||
"x.b.pinning2.example.com");
|
||||
|
||||
checkDefaultSiteHPKPStatus();
|
||||
|
||||
|
@ -209,38 +241,46 @@ function checkStateRead(aSubject, aTopic, aData) {
|
|||
|
||||
// Check a dynamic addition works as expected
|
||||
// first, it should succeed with the badCA - because there's no pin
|
||||
checkOK(certFromFile('b.preload.example.com-badca'), "b.preload.example.com");
|
||||
checkOK(certFromFile("b.preload.example.com-badca"), "b.preload.example.com");
|
||||
// then we add a pin, and we should get a failure (ensuring the expiry is
|
||||
// after the test timeout)
|
||||
gSSService.setKeyPins("b.preload.example.com", false,
|
||||
new Date().getTime() + 1000000, 2,
|
||||
[NON_ISSUED_KEY_HASH, PINNING_ROOT_KEY_HASH], true);
|
||||
checkFail(certFromFile('b.preload.example.com-badca'), "b.preload.example.com");
|
||||
checkFail(certFromFile("b.preload.example.com-badca"), "b.preload.example.com");
|
||||
|
||||
do_timeout(1250, checkExpiredState);
|
||||
}
|
||||
|
||||
function checkExpiredState() {
|
||||
checkOK(certFromFile('a.pinning2.example.com-badca'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('a.pinning2.example.com-pinningroot'), "a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-badca'), "x.a.pinning2.example.com");
|
||||
checkOK(certFromFile('x.a.pinning2.example.com-pinningroot'), "x.a.pinning2.example.com");
|
||||
checkOK(certFromFile("a.pinning2.example.com-badca"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("a.pinning2.example.com-pinningroot"),
|
||||
"a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-badca"),
|
||||
"x.a.pinning2.example.com");
|
||||
checkOK(certFromFile("x.a.pinning2.example.com-pinningroot"),
|
||||
"x.a.pinning2.example.com");
|
||||
|
||||
checkFail(certFromFile('b.pinning2.example.com-badca'), "b.pinning2.example.com");
|
||||
checkOK(certFromFile('b.pinning2.example.com-pinningroot'), "b.pinning2.example.com");
|
||||
checkFail(certFromFile('x.b.pinning2.example.com-badca'), "x.b.pinning2.example.com");
|
||||
checkOK(certFromFile('x.b.pinning2.example.com-pinningroot'), "x.b.pinning2.example.com");
|
||||
checkFail(certFromFile("b.pinning2.example.com-badca"),
|
||||
"b.pinning2.example.com");
|
||||
checkOK(certFromFile("b.pinning2.example.com-pinningroot"),
|
||||
"b.pinning2.example.com");
|
||||
checkFail(certFromFile("x.b.pinning2.example.com-badca"),
|
||||
"x.b.pinning2.example.com");
|
||||
checkOK(certFromFile("x.b.pinning2.example.com-pinningroot"),
|
||||
"x.b.pinning2.example.com");
|
||||
checkPreloadClear();
|
||||
}
|
||||
|
||||
function checkPreloadClear() {
|
||||
// Check that the preloaded pins still work after private data is cleared
|
||||
gSSService.clearAll();
|
||||
checkFail(certFromFile('b.preload.example.com-badca'), "b.preload.example.com");
|
||||
checkFail(certFromFile("b.preload.example.com-badca"), "b.preload.example.com");
|
||||
|
||||
// Check that the preloaded pins are cleared when we clear preloads
|
||||
gSSService.clearPreloads();
|
||||
checkOK(certFromFile('b.preload.example.com-badca'), "b.preload.example.com");
|
||||
checkOK(certFromFile("b.preload.example.com-badca"), "b.preload.example.com");
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ function loadCert(cert_name, trust_string) {
|
|||
|
||||
function checkFailParseInvalidPin(pinValue) {
|
||||
let sslStatus = new FakeSSLStatus(
|
||||
certFromFile('a.pinning2.example.com-pinningroot'));
|
||||
certFromFile("a.pinning2.example.com-pinningroot"));
|
||||
let uri = Services.io.newURI("https://a.pinning2.example.com", null, null);
|
||||
throws(() => {
|
||||
gSSService.processHeader(Ci.nsISiteSecurityService.HEADER_HPKP, uri,
|
||||
|
@ -34,7 +34,7 @@ function checkFailParseInvalidPin(pinValue) {
|
|||
|
||||
function checkPassValidPin(pinValue, settingPin, expectedMaxAge) {
|
||||
let sslStatus = new FakeSSLStatus(
|
||||
certFromFile('a.pinning2.example.com-pinningroot'));
|
||||
certFromFile("a.pinning2.example.com-pinningroot"));
|
||||
let uri = Services.io.newURI("https://a.pinning2.example.com", null, null);
|
||||
let maxAge = {};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function do_state_written(aSubject, aTopic, aData) {
|
|||
ok(stateFile.exists());
|
||||
let stateFileContents = readFile(stateFile);
|
||||
// the last part is removed because it's the empty string after the final \n
|
||||
let lines = stateFileContents.split('\n').slice(0, -1);
|
||||
let lines = stateFileContents.split("\n").slice(0, -1);
|
||||
// We can receive multiple data-storage-written events. In particular, we
|
||||
// may receive one where DataStorage wrote out data before we were done
|
||||
// processing all of our headers. In this case, the data may not be
|
||||
|
|
|
@ -29,15 +29,15 @@ function checkStateWritten(aSubject, aTopic, aData) {
|
|||
ok(stateFile.exists());
|
||||
let stateFileContents = readFile(stateFile);
|
||||
// the last line is removed because it's just a trailing newline
|
||||
let lines = stateFileContents.split('\n').slice(0, -1);
|
||||
let lines = stateFileContents.split("\n").slice(0, -1);
|
||||
equal(lines.length, EXPECTED_ENTRIES);
|
||||
let sites = {}; // a map of domain name -> [the entry in the state file]
|
||||
for (let line of lines) {
|
||||
let parts = line.split('\t');
|
||||
let parts = line.split("\t");
|
||||
let host = parts[0];
|
||||
let score = parts[1];
|
||||
let lastAccessed = parts[2];
|
||||
let entry = parts[3].split(',');
|
||||
let entry = parts[3].split(",");
|
||||
let expectedColumns = EXPECTED_HSTS_COLUMNS;
|
||||
if (host.indexOf("HPKP") != -1) {
|
||||
expectedColumns = EXPECTED_HPKP_COLUMNS;
|
||||
|
|
|
@ -19,7 +19,7 @@ if (arguments.length != 3) {
|
|||
"<absolute path to StaticHPKPins.h>");
|
||||
}
|
||||
|
||||
var { 'classes': Cc, 'interfaces': Ci, 'utils': Cu, 'results': Cr } = Components;
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
var { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
var { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {});
|
||||
|
@ -236,7 +236,7 @@ function downloadAndParseChromeCerts(filename, certNameToSKD, certSKDToName) {
|
|||
let chromeName;
|
||||
for (let line of lines) {
|
||||
// Skip comments and newlines.
|
||||
if (line.length == 0 || line[0] == '#') {
|
||||
if (line.length == 0 || line[0] == "#") {
|
||||
continue;
|
||||
}
|
||||
switch (state) {
|
||||
|
|
|
@ -62,7 +62,7 @@ function writeString(fos, string) {
|
|||
|
||||
// Remove all colons from a string
|
||||
function stripColons(hexString) {
|
||||
return hexString.replace(/:/g, '');
|
||||
return hexString.replace(/:/g, "");
|
||||
}
|
||||
|
||||
// Expect an array of bytes and make it C-formatted
|
||||
|
@ -110,7 +110,7 @@ function loadTrustAnchors(file) {
|
|||
function writeTrustAnchors(file) {
|
||||
let fos = FileUtils.openSafeFileOutputStream(file);
|
||||
|
||||
let serializedData = JSON.stringify(gTrustAnchors, null, ' ');
|
||||
let serializedData = JSON.stringify(gTrustAnchors, null, " ");
|
||||
fos.write(JSON_HEADER, JSON_HEADER.length);
|
||||
fos.write(serializedData, serializedData.length);
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ function output(sortedStatuses, currentList) {
|
|||
// lengths of string literals, and the preload list is large enough
|
||||
// that it runs into said limits.
|
||||
for (let c of status.name) {
|
||||
writeTo("'" + c + "', ", fos);
|
||||
writeTo("'" + c + "', ", fos);
|
||||
}
|
||||
writeTo("'\\0',\n", fos);
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ function compareCertificatesByHash(certA, certB) {
|
|||
|
||||
function certToPEM(cert) {
|
||||
let der = cert.getRawDER({});
|
||||
let derString = '';
|
||||
let derString = "";
|
||||
for (let i = 0; i < der.length; i++) {
|
||||
derString += String.fromCharCode(der[i]);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче