Skip to content

Commit 03049b3

Browse files
committed
Clean comments & review nits.
Signed-off-by: Nick Semenkovich <semenko@alum.mit.edu>
1 parent e764b1e commit 03049b3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

chromium/rules.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ RuleSets.prototype = {
271271
this.ruleCache.set(host, results);
272272

273273
// Cap the size of the cache. (Limit chosen somewhat arbitrarily)
274-
if (this.ruleCache.size > 1000) { this.ruleCache.delete(this.ruleCache.keys().next().value) }
274+
if (this.ruleCache.size > 1000) {
275+
// Map.prototype.keys() returns keys in insertion order, so this is a FIFO.
276+
this.ruleCache.delete(this.ruleCache.keys().next().value);
277+
}
275278

276279
return results;
277280
},
@@ -344,7 +347,10 @@ RuleSets.prototype = {
344347
var test_uri = "http://" + domain + nonce_path + nonce_path;
345348

346349
// Cap the size of the cookie cache (limit chosen somewhat arbitrarily)
347-
if (this.cookieHostCache.size > 250) { this.cookieHostCache.delete(this.cookieHostCache.keys().next().value) }
350+
if (this.cookieHostCache.size > 250) {
351+
// Map.prototype.keys() returns keys in insertion order, so this is a FIFO.
352+
this.cookieHostCache.delete(this.cookieHostCache.keys().next().value);
353+
}
348354

349355
log(INFO, "Testing securecookie applicability with " + test_uri);
350356
var rs = this.potentiallyApplicableRulesets(domain);

0 commit comments

Comments
 (0)