Skip to content

Commit 42b195a

Browse files
committed
Fix style issues found by cooperq in SSL Obs.
1 parent 9c9b55b commit 42b195a

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

src/components/ssl-observatory.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let MAX_OUTSTANDING = 20; // Max # submission XHRs in progress
1919
let MAX_DELAYED = 32; // Max # XHRs are waiting around to be sent or retried
2020

2121
let ASN_PRIVATE = -1; // Do not record the ASN this cert was seen on
22-
let ASN_IMPLICIT = -2 // ASN can be learned from connecting IP
22+
let ASN_IMPLICIT = -2; // ASN can be learned from connecting IP
2323
let ASN_UNKNOWABLE = -3; // Cert was seen in the absence of [trustworthy] Internet access
2424

2525
// XXX: We should make the _observatory tree relative.
@@ -322,10 +322,10 @@ SSLObservatory.prototype = {
322322

323323
var host_ip = "-1";
324324
var httpchannelinternal = subject.QueryInterface(Ci.nsIHttpChannelInternal);
325-
try {
325+
try {
326326
host_ip = httpchannelinternal.remoteAddress;
327327
} catch(e) {
328-
this.log(INFO, "Could not get server IP address.");
328+
this.log(INFO, "Could not get server IP address.");
329329
}
330330
subject.QueryInterface(Ci.nsIHttpChannel);
331331
var certchain = this.getSSLCert(subject);
@@ -356,16 +356,16 @@ SSLObservatory.prototype = {
356356
}
357357

358358
if (subject.URI.port == -1) {
359-
this.submitChain(chainArray, fps, new String(subject.URI.host), subject, host_ip, false);
359+
this.submitChain(chainArray, fps, new String(subject.URI.host), subject, host_ip, false);
360360
} else {
361-
this.submitChain(chainArray, fps, subject.URI.host+":"+subject.URI.port, subject, host_ip, false);
361+
this.submitChain(chainArray, fps, subject.URI.host+":"+subject.URI.port, subject, host_ip, false);
362362
}
363363
}
364364
}
365365
},
366366

367367
observatoryActive: function() {
368-
368+
369369
if (!this.myGetBoolPref("enabled"))
370370
return false;
371371

@@ -394,7 +394,7 @@ SSLObservatory.prototype = {
394394
var pbs = CC["@mozilla.org/privatebrowsing;1"].getService(CI.nsIPrivateBrowsingService);
395395
if (pbs.privateBrowsingEnabled) return false;
396396
} catch (e) { /* seamonkey or old firefox */ }
397-
397+
398398
return true;
399399
}
400400

@@ -453,7 +453,7 @@ SSLObservatory.prototype = {
453453
if (!convergence || !convergence.enabled) return null;
454454

455455
this.log(INFO, "Convergence uses its own internal root certs; not submitting those");
456-
456+
457457
//this.log(WARN, convergence.certificateStatus.getVerificiationStatus(chain.certArray[0]));
458458
try {
459459
var certInfo = this.extractRealLeafFromConveregenceLeaf(chain.certArray[0]);
@@ -623,10 +623,11 @@ SSLObservatory.prototype = {
623623

624624
if (req.status == 200) {
625625
that.log(INFO, "Successful cert submission");
626-
if (!that.prefs.getBoolPref("extensions.https_everywhere._observatory.cache_submitted"))
627-
if (c.fps[0] in that.already_submitted)
628-
delete that.already_submitted[c.fps[0]];
629-
626+
if (!that.prefs.getBoolPref("extensions.https_everywhere._observatory.cache_submitted") &&
627+
c.fps[0] in that.already_submitted) {
628+
delete that.already_submitted[c.fps[0]];
629+
}
630+
630631
// Retry up to two previously failed submissions
631632
let n = 0;
632633
for (let fp in that.delayed_submissions) {
@@ -646,22 +647,22 @@ SSLObservatory.prototype = {
646647
}
647648
} else {
648649
// Submission failed
649-
if (c.fps[0] in that.already_submitted)
650+
if (c.fps[0] in that.already_submitted) {
650651
delete that.already_submitted[c.fps[0]];
652+
}
651653
try {
652654
that.log(WARN, "Cert submission failure "+req.status+": "+req.responseText);
653655
} catch(e) {
654656
that.log(WARN, "Cert submission failure and exception: "+e);
655657
}
656658
// If we don't have too many delayed submissions, and this isn't
657659
// (somehow?) one of them, then plan to retry this submission later
658-
if (Object.keys(that.delayed_submissions).length < MAX_DELAYED)
659-
if (!(c.fps[0] in that.delayed_submissions)) {
660-
that.log(WARN, "Planning to retry submission...");
661-
let retry = function() { that.submitChain(certArray, fps, domain, channel, host_ip, true); };
662-
that.delayed_submissions[c.fps[0]] = retry;
663-
}
664-
660+
if (Object.keys(that.delayed_submissions).length < MAX_DELAYED &&
661+
c.fps[0] in that.delayed_submissions) {
662+
that.log(WARN, "Planning to retry submission...");
663+
let retry = function() { that.submitChain(certArray, fps, domain, channel, host_ip, true); };
664+
that.delayed_submissions[c.fps[0]] = retry;
665+
}
665666
}
666667
}
667668
};
@@ -873,7 +874,7 @@ SSLObservatory.prototype = {
873874

874875
encString: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
875876
encStringS: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
876-
877+
877878
log: function(level, str) {
878879
var econsole = CC["@mozilla.org/consoleservice;1"]
879880
.getService(CI.nsIConsoleService);
@@ -890,7 +891,7 @@ SSLObservatory.prototype = {
890891
// so only do it when a pref is set (running from test.sh enables
891892
// this pref).
892893
if (this.prefs.getBoolPref("log_to_stdout")) {
893-
dump(prefix + str + "\n");
894+
dump(prefix + str + "\n");
894895
}
895896
econsole.logStringMessage(prefix + str);
896897
}

0 commit comments

Comments
 (0)