Skip to content

Commit 82bbe2a

Browse files
author
MB
committed
oMerge github.com/EFForg/https-everywhere
2 parents a017d40 + d91505b commit 82bbe2a

473 files changed

Lines changed: 2586 additions & 4190 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,32 @@ addons:
1111
apt:
1212
packages:
1313
- libxml2-dev
14+
- libxml2-utils
1415
- python-dev
1516
- libcurl4-openssl-dev
1617
- python-lxml
1718
- python-software-properties
1819
- chromium-browser
19-
firefox: "40.0"
2020
virtualenv:
2121
system_site_packages: true
2222
install:
2323
- pip install -r test/rules/requirements.txt
2424
- pip install -r test/chromium/requirements.txt
2525
env:
26-
- DISPLAY=':99.0'
26+
- FIREFOX_VERSION=firefox-latest
27+
- FIREFOX_VERSION=firefox-esr-latest
2728
before_script:
28-
- export DISPLAY=:99.0
2929
- sh -e /etc/init.d/xvfb start
30-
- wget https://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip
30+
- wget https://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip
3131
- unzip chromedriver_linux64.zip
3232
- mv chromedriver test/chromium/chromedriver
33+
- wget -O /tmp/firefox.tar.bz2 'https://download.mozilla.org/?os=linux64&lang=en-US&product='$FIREFOX_VERSION
34+
- tar xpjf /tmp/firefox.tar.bz2
35+
- export DISPLAY=:99.0 FIREFOX=$PWD/firefox/firefox
3336
script:
3437
- ./test.sh
35-
sudo: false
38+
sudo: required
39+
dist: trusty
3640
notifications:
3741
email:
3842
recipients:

chromium/rules.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,12 @@ function CookieRule(host, cookiename) {
4040
/**
4141
*A collection of rules
4242
* @param set_name The name of this set
43-
* @param match_rule Quick test match rule
4443
* @param default_state activity state
4544
* @param note Note will be displayed in popup
4645
* @constructor
4746
*/
48-
function RuleSet(set_name, match_rule, default_state, note) {
47+
function RuleSet(set_name, default_state, note) {
4948
this.name = set_name;
50-
if (match_rule)
51-
this.ruleset_match_c = new RegExp(match_rule);
52-
else
53-
this.ruleset_match_c = null;
5449
this.rules = [];
5550
this.exclusions = [];
5651
this.targets = [];
@@ -75,11 +70,6 @@ RuleSet.prototype = {
7570
return null;
7671
}
7772
}
78-
// If a ruleset has a match_rule and it fails, go no further
79-
if (this.ruleset_match_c && !this.ruleset_match_c.test(urispec)) {
80-
log(VERB, "ruleset_match_c excluded " + urispec);
81-
return null;
82-
}
8373

8474
// Okay, now find the first rule that triggers
8575
for(var i = 0; i < this.rules.length; ++i) {
@@ -89,12 +79,6 @@ RuleSet.prototype = {
8979
return returl;
9080
}
9181
}
92-
if (this.ruleset_match_c) {
93-
// This is not an error, because we do not insist the matchrule
94-
// precisely describes to target space of URLs ot redirected
95-
log(DBUG,"Ruleset "+this.name
96-
+" had an applicable match-rule but no matching rules");
97-
}
9882
return null;
9983
}
10084

@@ -162,7 +146,7 @@ RuleSets.prototype = {
162146
*/
163147
addUserRule : function(params) {
164148
log(INFO, 'adding new user rule for ' + JSON.stringify(params));
165-
var new_rule_set = new RuleSet(params.host, null, true, "user rule");
149+
var new_rule_set = new RuleSet(params.host, true, "user rule");
166150
var new_rule = new Rule(params.urlMatcher, params.redirectTo);
167151
new_rule_set.rules.push(new_rule);
168152
if (!(params.host in this.targets)) {
@@ -202,7 +186,6 @@ RuleSets.prototype = {
202186
}
203187

204188
var rule_set = new RuleSet(ruletag.getAttribute("name"),
205-
ruletag.getAttribute("match_rule"),
206189
default_state,
207190
note.trim());
208191

ruleset-testing.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ target host with a left-side wildcard, and at least ten test URLs for each
3030
target host with a right-side wildcard. But this is not yet implemented.
3131

3232
# Example:
33-
<ruleset name="example.com">
34-
<target host="example.com" />
35-
<target host="*.example.com" />
33+
<ruleset name="example.com">
34+
<target host="example.com" />
35+
<target host="*.example.com" />
3636

37-
<test url="http://www.example.com/" />
38-
<test url="http://beta.example.com/" />
37+
<test url="http://www.example.com/" />
38+
<test url="http://beta.example.com/" />
3939

40-
<rule from="^http://([\w-]+\.)?dezeen\.com/"
41-
to="https://$1dezeen.com/" />
40+
<rule from="^http://([\w-]+\.)?dezeen\.com/"
41+
to="https://$1dezeen.com/" />
4242

43-
</ruleset>
43+
</ruleset>
4444

4545
This ruleset has one implicit test URL from a target host
4646
("http://example.com/"). The other target host has a wildcard, so creates no
@@ -63,4 +63,4 @@ a submodule of https-everywhere. To set it up, run:
6363

6464
To test a specific ruleset:
6565

66-
./fetch-test.sh rules/Example.xml
66+
./fetch-test.sh rules/Example.xml

src/chrome/content/about.xul

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@
4848

4949
<groupbox>
5050
<caption label="&https-everywhere.about.librarians;" />
51-
<label>Seth Schoen, MB and Andreas Jonsson</label>
51+
<label>J0WI, MB, Nick Semenkovich, Sam Reed, and Søren Fuglede Jørgensen</label>
5252
</groupbox>
5353

5454
<groupbox>
5555
<caption label="&https-everywhere.about.thanks;" />
5656
<label>Many many contributors, including Aaron Swartz, Alec Moskvin,
57-
Aleksey Kosterin, Alex Xu, Anas Qtiesh, Artyom Gavrichenkov, Brian
57+
Aleksey Kosterin, Alex Xu, Anas Qtiesh, Andreas Jonsson, Artyom Gavrichenkov, Brian
5858
Carpenter, Chris Palmer, Christian Inci, Christopher Liu, Claudio
5959
Moretti, Colonel Graff, Dan Auerbach, Daniel Kahn Gillmor, dm0, The
6060
Doctor, Felix Geyer, Fruitless Creek, George Kargiotakis, haviah, Heiko
6161
Adams, Jeroen van der Gun, Jay Weisskopf, Jacob Taylor, Jonathan Davies, Jorge Bernal,
6262
katmagic, Kevin Jacobs, Korte, Liam K, Leonardo Brondani Schenkel, Marti Raudsepp, Micah Lee, Mike
6363
Cardwell, Mangix, Matthias-Christian Ott, Mikko Harhanen, Mishari Muqbil, Neheb, Ori Avtalion, Osama Khalid,
6464
nitrox, Pablo Castellano, Paul Wise, Pavel Kazakov, Phol Paucar, Richard
65-
Green, Roan Kattouw, Rules Moore, Stefan Tomanek, Sam Reed, Steve
65+
Green, Roan Kattouw, Rules Moore, Seth Schoen, Stefan Tomanek, Sam Reed, Steve
6666
Milner, Sujit Rao, TK-999, Vendo, Victor Garin, Weiland Hoffmann, Whizz
6767
Mo and Yan Zhu. Also, portions of HTTPS Everywhere are based on code
6868
from NoScript, by Giorgio Maone and others. We are grateful for their

src/chrome/content/code/AndroidUI.jsm

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ var popupInfo = {
106106
this.ruleItems.push({ label: rule, selected: true });
107107
this.ruleStatus.push(true);
108108
this.rules.push(this.alist.active[rule]);
109-
} else if (this.alist.moot.hasOwnProperty(rule)) {
110-
// moot rules are checked and toggleable too
111-
this.ruleItems.push({ label: rule, selected: true });
112-
this.ruleStatus.push(true);
113-
this.rules.push(this.alist.moot[rule]);
114109
} else if (this.alist.inactive.hasOwnProperty(rule)) {
115110
// inactive rules are unchecked and toggleable
116111
this.ruleItems.push({ label: rule });

src/chrome/content/code/ApplicableList.js

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ function ApplicableList(logger, uri) {
1717
this.active = {};
1818
this.breaking = {}; // rulesets with redirection loops
1919
this.inactive = {};
20-
this.moot={}; // rulesets that might be applicable but uris are already https
21-
this.all={}; // active + breaking + inactive + moot
20+
this.all={}; // active + breaking + inactive
2221
serial_number += 1;
2322
this.serial = serial_number;
2423
this.log(DBUG,"Alist serial #" + this.serial + " for " + this.home);
@@ -32,7 +31,6 @@ ApplicableList.prototype = {
3231
this.active = {};
3332
this.breaking = {};
3433
this.inactive = {};
35-
this.moot={};
3634
this.all={};
3735
},
3836

@@ -58,12 +56,6 @@ ApplicableList.prototype = {
5856
this.all[ruleset.name] = ruleset;
5957
},
6058

61-
moot_rule: function(ruleset) {
62-
this.log(INFO,"moot rule " + ruleset.name +" in "+ this.home + " serial " + this.serial);
63-
this.moot[ruleset.name] = ruleset;
64-
this.all[ruleset.name] = ruleset;
65-
},
66-
6759
dom_handler: function(operation,key,data,src,dst) {
6860
// See https://developer.mozilla.org/En/DOM/UserDataHandler
6961
if (src && dst)
@@ -182,19 +174,13 @@ ApplicableList.prototype = {
182174
this.add_command(this.breaking[x]);
183175
for(var x in this.active)
184176
this.add_command(this.active[x]);
185-
for(var x in this.moot)
186-
this.add_command(this.moot[x]);
187177
for(var x in this.inactive)
188178
this.add_command(this.inactive[x]);
189179

190180
if(https_everywhere.prefs.getBoolPref("globalEnabled")){
191181
// add all the menu items
192182
for (var x in this.inactive)
193183
this.add_menuitem(this.inactive[x], 'inactive');
194-
// rules that are active for some uris are not really moot
195-
for (var x in this.moot)
196-
if (!(x in this.active))
197-
this.add_menuitem(this.moot[x], 'moot');
198184
// break once break everywhere
199185
for (var x in this.active)
200186
if (!(x in this.breaking))
@@ -220,9 +206,8 @@ ApplicableList.prototype = {
220206
this.commandset.appendChild(command);
221207
},
222208

223-
// add a menu item for a rule -- type is "active", "inactive", "moot",
209+
// add a menu item for a rule -- type is "active", "inactive"
224210
// or "breaking"
225-
226211
add_menuitem: function(rule, type) {
227212
// create the menuitem
228213
var item = this.document.createElement('menuitem');
@@ -233,37 +218,20 @@ ApplicableList.prototype = {
233218

234219
// we can get confused if rulesets have their state changed after the
235220
// ApplicableList was constructed
236-
if (!rule.active && (type == 'active' || type == 'moot'))
221+
if (!rule.active && (type == 'active'))
237222
type = 'inactive';
238223
if (rule.active && type == 'inactive')
239-
type = 'moot';
240-
224+
type = 'active';
225+
241226
// set the icon
242227
var image_src;
243228
if (type == 'active') image_src = 'tick.png';
244229
else if (type == 'inactive') image_src = 'cross.png';
245-
else if (type == 'moot') image_src = 'tick-moot.png';
246230
else if (type == 'breaking') image_src = 'loop.png';
247231
item.setAttribute('image', 'chrome://https-everywhere/skin/'+image_src);
248232

249233
// all done
250234
this.prepend_child(item);
251-
},
252-
253-
show_applicable: function() {
254-
this.log(WARN, "Applicable list number " + this.serial);
255-
for (var x in this.active)
256-
this.log(WARN,"Active: " + this.active[x].name);
257-
258-
for (var x in this.breaking)
259-
this.log(WARN,"Breaking: " + this.breaking[x].name);
260-
261-
for (x in this.inactive)
262-
this.log(WARN,"Inactive: " + this.inactive[x].name);
263-
264-
for (x in this.moot)
265-
this.log(WARN,"Moot: " + this.moot[x].name);
266-
267235
}
268236
};
269237

0 commit comments

Comments
 (0)