From 992b9959b00334413cc16c761e37abc1cdd125bc Mon Sep 17 00:00:00 2001 From: Nick Semenkovich Date: Thu, 2 Apr 2015 21:43:27 -0500 Subject: [PATCH 1/3] Strict mode Signed-off-by: Nick Semenkovich --- chromium/background.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chromium/background.js b/chromium/background.js index 117285b5cf13..e26bcba418aa 100644 --- a/chromium/background.js +++ b/chromium/background.js @@ -1,3 +1,4 @@ +"use strict"; /** * Fetch and parse XML to be loaded as RuleSets. */ From 18ca9cfba89fa704f32bb8e421ec3213fd7297d4 Mon Sep 17 00:00:00 2001 From: Nick Semenkovich Date: Thu, 2 Apr 2015 21:52:26 -0500 Subject: [PATCH 2/3] Remove random try/catch Not clear to me what this was catching... Signed-off-by: Nick Semenkovich --- chromium/rules.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/chromium/rules.js b/chromium/rules.js index 21a3b5aa2756..8de5ea20577a 100644 --- a/chromium/rules.js +++ b/chromium/rules.js @@ -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; @@ -290,16 +290,8 @@ 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); From dd266891cc5daba933685e31213b24a762566599 Mon Sep 17 00:00:00 2001 From: Nick Semenkovich Date: Thu, 2 Apr 2015 21:55:20 -0500 Subject: [PATCH 3/3] Remove some unnecessary logging Signed-off-by: Nick Semenkovich --- chromium/rules.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chromium/rules.js b/chromium/rules.js index 8de5ea20577a..8ea6951fc372 100644 --- a/chromium/rules.js +++ b/chromium/rules.js @@ -297,9 +297,8 @@ RuleSets.prototype = { 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; }