Skip to content

Commit d85ba9b

Browse files
committed
Revert "Bug 10298: Provide a preference to enable mixed content rules."
https://trac.torproject.org/projects/tor/ticket/10344 This reverts commit 613ea2f.
1 parent fbbd60a commit d85ba9b

File tree

3 files changed

+17
-47
lines changed

3 files changed

+17
-47
lines changed

src/chrome/content/code/HTTPSRules.js

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ function CookieRule(host, cookiename) {
1616
this.name_c = new RegExp(cookiename);
1717
}
1818

19+
// Firefox 23+ blocks mixed content by default, so rulesets that create
20+
// mixed content situations should be disabled there
21+
22+
try {
23+
var appPrefs = CC["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
24+
var blockMixedContent = appPrefs.getBoolPref("security.mixed_content.block_active_content");
25+
if(blockMixedContent) {
26+
localPlatformRegexp = new RegExp("firefox");
27+
} else {
28+
localPlatformRegexp = new RegExp("(firefox|mixedcontent)");
29+
}
30+
} catch(e) {
31+
localPlatformRegexp = new RegExp("(firefox|mixedcontent)");
32+
}
33+
1934
ruleset_counter = 0;
2035
function RuleSet(name, xmlName, match_rule, default_off, platform) {
2136
if(xmlName == "WordPress.xml" || xmlName == "Github.xml") {
@@ -39,7 +54,7 @@ function RuleSet(name, xmlName, match_rule, default_off, platform) {
3954
this.on_by_default = false;
4055
}
4156
if (platform)
42-
if (platform.search(HTTPSRules.localPlatformRegexp) == -1) {
57+
if (platform.search(localPlatformRegexp) == -1) {
4358
this.on_by_default = false;
4459
this.notes = "Only for " + platform;
4560
}
@@ -383,7 +398,6 @@ const HTTPSRules = {
383398
this.rulesetsByID = {};
384399
this.rulesetsByName = {};
385400
var t1 = new Date().getTime();
386-
this.checkMixedContentHandling();
387401
var rulefiles = RuleWriter.enumerate(RuleWriter.getCustomRuleDir());
388402
this.scanRulefiles(rulefiles);
389403
rulefiles = RuleWriter.enumerate(RuleWriter.getRuleDir());
@@ -414,30 +428,6 @@ const HTTPSRules = {
414428
return;
415429
},
416430

417-
checkMixedContentHandling: function() {
418-
// Firefox 23+ blocks mixed content by default, so rulesets that create
419-
// mixed content situations should be disabled there
420-
var appInfo = CC["@mozilla.org/xre/app-info;1"].getService(CI.nsIXULAppInfo);
421-
var platformVer = appInfo.platformVersion;
422-
var versionChecker = CC["@mozilla.org/xpcom/version-comparator;1"]
423-
.getService(CI.nsIVersionComparator);
424-
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
425-
.getService(Components.interfaces.nsIPrefService).getBranch("");
426-
427-
428-
// If mixed content is present and enabled, and the user hasn't opted to enable
429-
// mixed content triggering rules, leave them out. Otherwise add them in.
430-
if(versionChecker.compare(appInfo.version, "23.0a1") >= 0
431-
&& prefs.getBoolPref("security.mixed_content.block_active_content")
432-
&& !prefs.getBoolPref("extensions.https_everywhere.enable_mixed_rulesets")) {
433-
this.log(INFO, "Not loading rules that trigger mixed content errors.");
434-
this.localPlatformRegexp = new RegExp("firefox");
435-
} else {
436-
this.log(INFO, "Loading rules that would normally trigger mixed content");
437-
this.localPlatformRegexp = new RegExp("(firefox|mixedcontent)");
438-
}
439-
},
440-
441431
scanRulefiles: function(rulefiles) {
442432
var i = 0;
443433
var r = null;

src/components/https-everywhere.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,7 @@ function HTTPSEverywhere() {
199199
this.obsService.addObserver(this, "profile-after-change", false);
200200
this.obsService.addObserver(this, "sessionstore-windows-restored", false);
201201
}
202-
203-
var pref_service = Components.classes["@mozilla.org/preferences-service;1"]
204-
.getService(Components.interfaces.nsIPrefBranchInternal);
205-
var branch = pref_service.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
206-
207-
branch.addObserver("extensions.https_everywhere.enable_mixed_rulesets",
208-
this, false);
209-
branch.addObserver("security.mixed_content.block_active_content",
210-
this, false);
211-
202+
212203
return;
213204
}
214205

@@ -520,13 +511,6 @@ HTTPSEverywhere.prototype = {
520511
} else if (topic == "sessionstore-windows-restored") {
521512
this.log(DBUG,"Got sessionstore-windows-restored");
522513
this.maybeShowObservatoryPopup();
523-
} else if (topic == "nsPref:changed") {
524-
switch (data) {
525-
case "security.mixed_content.block_active_content":
526-
case "extensions.https_everywhere.enable_mixed_rulesets":
527-
HTTPSRules.init();
528-
break;
529-
}
530514
}
531515
return;
532516
},
@@ -740,7 +724,6 @@ HTTPSEverywhere.prototype = {
740724

741725
this.log(INFO,"ChannelReplacement.supported = "+ChannelReplacement.supported);
742726

743-
// XXX: Why is this called twice?
744727
HTTPSRules.init();
745728

746729
if(!Thread.hostRunning)

src/defaults/preferences/preferences.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ pref("extensions.https_everywhere.globalEnabled",true);
44
// this is the HTTPS Everywhere preferences version (for migrations)
55
pref("extensions.https_everywhere.prefs_version", 0);
66

7-
// enable rulesets that trigger mixed content blocking
8-
pref("extensions.https_everywhere.enable_mixed_rulesets", false);
9-
107
// SSl Observatory preferences
118
pref("extensions.https_everywhere._observatory.enabled",false);
129

0 commit comments

Comments
 (0)