Skip to content

Commit 54c26f7

Browse files
committed
Remove double call of resume and reorg loadRulesets
1 parent ec8b217 commit 54c26f7

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

src/chrome/content/code/HTTPS.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const HTTPS = {
5959
this.log(WARN, 'Failed to resume ' + channel.URI.spec + ': ' + e);
6060
return;
6161
}
62+
this.log(WARN, 'Succeeded to resume ' + channel.URI.spec + ' ');
6263
var isSTS = securityService.isSecureURI(
6364
CI.nsISiteSecurityService.HEADER_HSTS, channel.URI, 0);
6465
if (blob === null) {

src/chrome/content/code/HTTPSRules.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ const HTTPSRules = {
522522
if (userpass_present) blob.newuri.userPass = input_uri.userPass;
523523
blob.applied_ruleset = rs[i];
524524
callback(blob);
525+
return
525526
}
526527
if (uri.scheme == "https" && alist) {
527528
// we didn't rewrite but the rule applies to this domain and the
@@ -531,6 +532,7 @@ const HTTPSRules = {
531532
}
532533
}
533534
callback(null);
535+
return;
534536
});
535537
},
536538

@@ -605,26 +607,25 @@ const HTTPSRules = {
605607
rulesetsByTargets: function(targets, callback) {
606608
var output = [];
607609
var foundIds = [];
610+
var neededIds = [];
608611
var that = this;
609612
targets.forEach(function(target) {
610-
var rulesetIds = that.targets[target];
611-
612-
if (rulesetIds) {
613-
for (var i = 0; i < rulesetIds.length; i++) {
614-
var id = rulesetIds[i];
615-
if (!that.rulesetsByID[id]) {
616-
that.loadRulesetById(id);
617-
}
618-
if (that.rulesetsByID[id]) {
619-
foundIds.push(id);
620-
output.push(that.rulesetsByID[id]);
621-
}
613+
var rulesetIds = that.targets[target] || [];
614+
rulesetIds.forEach(function(id) {
615+
foundIds.push(id);
616+
if (!that.rulesetsByID[id]) {
617+
neededIds.push(id);
618+
} else {
619+
output.push(that.rulesetsByID[id]);
622620
}
623-
} else {
624-
that.log(DBUG, "For target " + target + ", found no ids in DB");
625-
}
621+
});
622+
});
623+
624+
neededIds.forEach(function(id) {
625+
that.loadRulesetById(id);
626+
output.push(that.rulesetsByID[id]);
626627
});
627-
that.log(DBUG, "For targets " + targets.join(' ') + ", found ids " + foundIds.join(','));
628+
that.log(WARN, "For targets " + targets.join(' ') + ", found ids " + foundIds.join(','));
628629
callback(output);
629630
},
630631

src/components/https-everywhere.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ HTTPSEverywhere.prototype = {
655655
// XXX: This causes NS_ERROR_UNAVAILABLE when replaceChannel tries to
656656
// suspend the channel.
657657
//HTTPS.replaceChannel(alist, newChannel, this.httpNowhereEnabled);
658+
//
658659
},
659660

660661
juggleApplicableListsDuringRedirection: function(oldChannel, newChannel) {

0 commit comments

Comments
 (0)