Skip to content

Commit 1d715f6

Browse files
committed
Merge pull request EFForg#4 from EFForg/master
update fork
2 parents 103e26c + 6347846 commit 1d715f6

2,157 files changed

Lines changed: 42895 additions & 20466 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.

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
path = https-everywhere-checker
66
url = https://github.com/jsha/https-everywhere-checker.git
77
branch = coverage
8+
[submodule "translations"]
9+
path = translations
10+
url = https://git.torproject.org/translation.git
11+
branch = https_everywhere

.travis.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,33 @@
33
language: python
44
python:
55
- "2.7"
6-
cache: pip
6+
cache:
7+
directories:
8+
- $HOME/.cache/pip
9+
- $HOME/virtualenv/python2.7_with_system_site_packages
710
addons:
811
apt:
912
packages:
1013
- libxml2-dev
1114
- python-dev
1215
- libcurl4-openssl-dev
1316
- python-lxml
17+
- python-software-properties
18+
- chromium-browser
1419
firefox: "37.0"
1520
virtualenv:
1621
system_site_packages: true
1722
install:
1823
- pip install -r https-everywhere-checker/requirements.txt
19-
before_script:
20-
- sh -e /etc/init.d/xvfb start
24+
- pip install -r test/chromium/requirements.txt
2125
env:
2226
- DISPLAY=':99.0'
27+
before_script:
28+
- export DISPLAY=:99.0
29+
- sh -e /etc/init.d/xvfb start
30+
- wget https://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip
31+
- unzip chromedriver_linux64.zip
32+
- mv chromedriver test/chromium/chromedriver
2333
script:
2434
- ./test.sh
2535
sudo: false
@@ -33,4 +43,3 @@ notifications:
3343
- "irc.oftc.net#https-everywhere"
3444
on_success: change
3545
on_failure: change
36-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Run the latest code and rulesets in a standalone Firefox profile:
1818

1919
Run the latest code and rulesets in a standalone Chromium profile:
2020

21-
bash run-chromium.sh
21+
bash test-chromium.sh --justrun
2222

2323
Build the Firefox extension as a .xpi package:
2424

chromium/background.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @param url: a relative URL to local XML
66
*/
7-
function getRuleXml(url) {
7+
function loadExtensionFile(url, returnType) {
88
var xhr = new XMLHttpRequest();
99
// Use blocking XHR to ensure everything is loaded by the time
1010
// we return.
@@ -14,14 +14,18 @@ function getRuleXml(url) {
1414
if (xhr.readyState != 4) {
1515
return;
1616
}
17-
return xhr.responseXML;
17+
if (returnType === 'xml') {
18+
return xhr.responseXML;
19+
}
20+
return xhr.responseText;
1821
}
1922

23+
2024
// Rules are loaded here
2125
var all_rules = new RuleSets(navigator.userAgent, LRUCache, localStorage);
22-
for (var i = 0; i < rule_list.length; i++) {
23-
all_rules.addFromXml(getRuleXml(rule_list[i]));
24-
}
26+
var rule_list = 'rules/default.rulesets';
27+
all_rules.addFromXml(loadExtensionFile(rule_list, 'xml'));
28+
2529

2630
var USER_RULE_KEY = 'userRules';
2731
// Records which tabId's are active in the HTTPS Switch Planner (see
@@ -504,7 +508,14 @@ function onBeforeRedirect(details) {
504508
}
505509

506510
// Registers the handler for requests
507-
wr.onBeforeRequest.addListener(onBeforeRequest, {urls: ["https://*/*", "http://*/*"]}, ["blocking"]);
511+
// We listen to all HTTP hosts, because RequestFilter can't handle tons of url restrictions.
512+
wr.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://*/*"]}, ["blocking"]);
513+
514+
// TODO: Listen only to the tiny subset of HTTPS hosts that we rewrite/downgrade.
515+
var httpsUrlsWeListenTo = ["https://*/*"];
516+
// See: https://developer.chrome.com/extensions/match_patterns
517+
wr.onBeforeRequest.addListener(onBeforeRequest, {urls: httpsUrlsWeListenTo}, ["blocking"]);
518+
508519

509520
// Try to catch redirect loops on URLs we've redirected to HTTPS.
510521
wr.onBeforeRedirect.addListener(onBeforeRedirect, {urls: ["https://*/*"]});

chromium/manifest.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"background": {
66
"scripts": [
77
"lru.js",
8-
"rule_list.js",
98
"rules.js",
109
"util.js",
1110
"background.js"
@@ -40,5 +39,5 @@
4039
"<all_urls>"
4140
],
4241
"update_url": "https://www.eff.org/files/https-everywhere-chrome-updates.xml",
43-
"version": "2015.7.13"
42+
"version": "2015.8.25"
4443
}

chromium/popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h1 i18n="about_ext_name"></h1>
2222
<a href="#" id="add-rule-link" i18n="menu_add_rule"></a>
2323
<div id="add-new-rule-div" style="display:none">
2424
<h3 i18n="about_add_new_rule"> </h3>
25-
<p i18n="menu_always_https_for_host">
25+
<p i18n="menu_always_https_for_host"></p>
2626
<label for="new-rule-host" i18n="menu_host"></label> <br><input size="50" id="new-rule-host" type="text" disabled><br>
2727

2828
<div id="new-rule-regular-text">

chromium/rule_list.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

chromium/rules.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ RuleSets.prototype = {
132132
addFromXml: function(ruleXml) {
133133
var sets = ruleXml.getElementsByTagName("ruleset");
134134
for (var i = 0; i < sets.length; ++i) {
135-
this.parseOneRuleset(sets[i]);
135+
try {
136+
this.parseOneRuleset(sets[i]);
137+
} catch (e) {
138+
log(WARN, 'Error processing ruleset:' + e);
139+
}
136140
}
137141
},
138142

chromium/util.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
VERB=1;
2-
DBUG=2;
3-
INFO=3;
4-
NOTE=4;
5-
WARN=5;
1+
"use strict";
2+
3+
var VERB=1;
4+
var DBUG=2;
5+
var INFO=3;
6+
var NOTE=4;
7+
var WARN=5;
68
// FYI: Logging everything is /very/ slow. Chrome will log & buffer
79
// these console logs even when the debug tools are closed. :(
810

911
// TODO: Add an easy UI to change the log level.
1012
// (Developers can just type DEFAULT_LOG_LEVEL=1 in the console)
11-
DEFAULT_LOG_LEVEL=4;
13+
var DEFAULT_LOG_LEVEL=4;
1214
console.log("Hey developer! Want to see more verbose logging?");
1315
console.log("Type this into the console: DEFAULT_LOG_LEVEL=1");
1416

https-everywhere-checker

0 commit comments

Comments
 (0)