Skip to content

Commit 0a6c2ae

Browse files
semenkodiracdeltas
authored andcommitted
Tweak ruleset calculation
Stop building unused test rules for the TLD itself (e.g. www.example.*) Also remove an intermediate varible assignment. Signed-off-by: Nick Semenkovich <semenko@alum.mit.edu>
1 parent af51867 commit 0a6c2ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

chromium/rules.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,21 @@ RuleSets.prototype = {
192192
}
193193
log(DBUG, "Ruleset cache miss for " + host);
194194

195-
var tmp, t;
195+
var tmp;
196196
var results = [];
197197
if (this.targets[host]) {
198198
// Copy the host targets so we don't modify them.
199199
results = this.targets[host].slice();
200200
}
201201

202-
// replace each portion of the domain with a * in turn
202+
// Replace each portion of the domain with a * in turn
203203
var segmented = host.split(".");
204-
for (var i = 0; i < segmented.length; ++i) {
204+
// length-1 to skip the TLD (there are no www.domain.* rules).
205+
for (var i = 0; i < segmented.length - 1; ++i) {
205206
tmp = segmented[i];
206207
segmented[i] = "*";
207-
t = segmented.join(".");
208+
this.setInsert(results, this.targets[segmented.join(".")]);
208209
segmented[i] = tmp;
209-
this.setInsert(results, this.targets[t]);
210210
}
211211
// now eat away from the left, with *, so that for x.y.z.google.com we
212212
// check *.z.google.com and *.google.com (we did *.y.z.google.com above)

0 commit comments

Comments
 (0)