Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chromium/background.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
/**
* Fetch and parse XML to be loaded as RuleSets.
*/
Expand Down
19 changes: 5 additions & 14 deletions chromium/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RuleSet.prototype = {
return null;
}
}
// If a rulset has a match_rule and it fails, go no further
// If a ruleset has a match_rule and it fails, go no further
if (this.ruleset_match_c && !this.ruleset_match_c.test(urispec)) {
log(VERB, "ruleset_match_c excluded " + urispec);
return null;
Expand Down Expand Up @@ -290,24 +290,15 @@ RuleSets.prototype = {
// If we passed that test, make up a random URL on the domain, and see if
// we would HTTPSify that.

try {
var nonce_path = "/" + Math.random().toString();
nonce_path = nonce_path + nonce_path;
var test_uri = "http://" + domain + nonce_path;
} catch (e) {
log(WARN, "explosion in safeToSecureCookie for " + domain + "\n"
+ "(" + e + ")");
this.cookieHostCache.set(domain, false);
return false;
}
var nonce_path = "/" + Math.random().toString();
var test_uri = "http://" + domain + nonce_path + nonce_path;

log(INFO, "Testing securecookie applicability with " + test_uri);
var rs = this.potentiallyApplicableRulesets(domain);
for (var i = 0; i < rs.length; ++i) {
if (!rs[i].active) continue;
var rewrite = rs[i].apply(test_uri);
if (rewrite) {
log(INFO, "Cookie domain could be secured: " + rewrite);
if (rs[i].apply(test_uri)) {
log(INFO, "Cookie domain could be secured.");
this.cookieHostCache.set(domain, true);
return true;
}
Expand Down