Skip to content

Commit 907b8c0

Browse files
semenkodiracdeltas
authored andcommitted
Move redirect loop detection to prior block
No sense in testing the redirect counter right after we set it. Signed-off-by: Nick Semenkovich <semenko@alum.mit.edu>
1 parent 9099c3a commit 907b8c0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

chromium/background.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,19 @@ function onBeforeRequest(details) {
116116
redirectCounter[details.requestId] += 1;
117117
log(DBUG, "Got redirect id "+details.requestId+
118118
": "+redirectCounter[details.requestId]);
119+
120+
if (redirectCounter[details.requestId] > 9) {
121+
log(NOTE, "Redirect counter hit for "+canonical_url);
122+
urlBlacklist[canonical_url] = true;
123+
var hostname = tmpuri.hostname();
124+
domainBlacklist[hostname] = true;
125+
log(WARN, "Domain blacklisted " + hostname);
126+
return;
127+
}
119128
} else {
120129
redirectCounter[details.requestId] = 0;
121130
}
122131

123-
if (redirectCounter[details.requestId] > 9) {
124-
log(NOTE, "Redirect counter hit for "+canonical_url);
125-
urlBlacklist[canonical_url] = true;
126-
var hostname = tmpuri.hostname();
127-
domainBlacklist[hostname] = true;
128-
log(WARN, "Domain blacklisted " + hostname);
129-
return;
130-
}
131-
132132
var newuristr = null;
133133

134134
var rs = all_rules.potentiallyApplicableRulesets(a.hostname);

0 commit comments

Comments
 (0)