Skip to content

Commit b3572d6

Browse files
committed
Merge branch 'master' into patch-64
2 parents 6864fd8 + 426fd62 commit b3572d6

File tree

3,064 files changed

+54252
-17901
lines changed

Some content is hidden

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

3,064 files changed

+54252
-17901
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# Config copied from
22
# http://www.theautomatedtester.co.uk/blog/2012/using-travis-ci-for-building-and-testing-firefox-addons.html
3-
# Use node_js because there are maybe more workers?
43
language: python
54
python:
65
- "2.7"
6+
cache: pip
77
addons:
8+
apt:
9+
packages:
10+
- libxml2-dev
11+
- python-dev
12+
- libcurl4-openssl-dev
13+
- python-lxml
814
firefox: "37.0"
915
virtualenv:
1016
system_site_packages: true
1117
install:
12-
- sudo apt-get -qq install libxml2-dev libxslt-dev python-dev libcurl4-openssl-dev python-lxml
1318
- pip install -r https-everywhere-checker/requirements.txt
1419
before_script:
1520
- sh -e /etc/init.d/xvfb start
1621
env:
1722
- DISPLAY=':99.0'
1823
script:
1924
- ./test.sh
25+
sudo: false
2026
notifications:
2127
email:
2228
recipients:

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,8 @@ Important directories you might want to know about
5959
Hacking on the Source Code
6060
--------------------------
6161

62-
The current stable release series is 4.0. The current development release series
63-
is 5.0. Each release series is represented by a branch with the major and minor
64-
version numbers, e.g. 4.0 or 5.0. This branch is updated during the lifecycle of
65-
the release series. Specific releases are represented as tags with the full
66-
version number, e.g. 4.0.0 or 5.0development.0.
67-
68-
If you are making a bug fix to the current stable release, you should
69-
work off of the stable branch, 4.0. If you are adding features or improving
70-
functionality, work off of master. The maintainers will merge master into the
71-
development series branch periodically. We will also occasionally merge ruleset
72-
fixes from master into the stable branch if the ruleset is important (i.e. a
73-
popular or high-security site), or if the version in stable is clearly broken.
62+
The current stable release series is 5.0. The maintainers release new versions
63+
off the current master branch about every two weeks.
7464

7565
To submit changes, either use pull requests on GitHub or email patches to
7666
https-everywhere-rulesets@lists.eff.org (rulesets) or

chromium/_locales/de/messages.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"menu_blockHttpRequests": {
3-
"message": "Block all HTTP requests"
3+
"message": "Alle HTTP requests blockieren"
44
},
55
"about_title": {
66
"message": "Über HTTPS Everywhere"
@@ -121,6 +121,39 @@
121121
},
122122
"chrome_what_is_this_title": {
123123
"message": "HTTPS-Everywhere-Webseite"
124+
},
125+
"menu_add_rule": {
126+
"message": "Regel für diese Seite hinzufügen"
127+
},
128+
"about_add_new_rule": {
129+
"message": "Eine Regel für diese Seite hinzufügen"
130+
},
131+
"menu_always_https_for_host": {
132+
"message": "Für diese Seite HTTPS erzwingen"
133+
},
134+
"menu_host": {
135+
"message": "Host:"
136+
},
137+
"menu_show_advanced": {
138+
"message": "Erweiterte Optionen anzeigen"
139+
},
140+
"menu_hide_advanced": {
141+
"message": "Erweiterte Optionen verstecken"
142+
},
143+
"menu_rule_name": {
144+
"message": "Regel Name"
145+
},
146+
"menu_regex": {
147+
"message": "Auslösende regex"
148+
},
149+
"menu_redirect_to": {
150+
"message": "Umleiten zu"
151+
},
152+
"menu_add_new_rule": {
153+
"message": "Neue Regel hinzufügen"
154+
},
155+
"status_cancel_button": {
156+
"message": "Abbrechen"
124157
}
125158
}
126159

chromium/_locales/en/messages.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,39 @@
121121
},
122122
"chrome_what_is_this_title": {
123123
"message": "HTTPS Everywhere website"
124+
},
125+
"menu_add_rule": {
126+
"message": "Add a rule for this site"
127+
},
128+
"about_add_new_rule": {
129+
"message": "Add a new rule for this site"
130+
},
131+
"menu_always_https_for_host": {
132+
"message": "Always use https for this host."
133+
},
134+
"menu_host": {
135+
"message": "Host:"
136+
},
137+
"menu_show_advanced": {
138+
"message": "Show advanced"
139+
},
140+
"menu_hide_advanced": {
141+
"message": "Hide advanced"
142+
},
143+
"menu_rule_name": {
144+
"message": "Rule name"
145+
},
146+
"menu_regex": {
147+
"message": "Matching regex"
148+
},
149+
"menu_redirect_to": {
150+
"message": "Redirect to"
151+
},
152+
"menu_add_new_rule": {
153+
"message": "Add new rule"
154+
},
155+
"status_cancel_button": {
156+
"message": "Cancel"
124157
}
125158
}
126159

chromium/background.js

Lines changed: 84 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use strict";
22
/**
33
* Fetch and parse XML to be loaded as RuleSets.
4+
*
5+
* @param url: a relative URL to local XML
46
*/
57
function getRuleXml(url) {
68
var xhr = new XMLHttpRequest();
@@ -15,7 +17,8 @@ function getRuleXml(url) {
1517
return xhr.responseXML;
1618
}
1719

18-
var all_rules = new RuleSets(navigator.userAgent, LRUCache, localStorage);
20+
// Rules are loaded here
21+
var all_rules = new RuleSets(navigator.userAgent, LRUCache, localStorage);
1922
for (var i = 0; i < rule_list.length; i++) {
2023
all_rules.addFromXml(getRuleXml(rule_list[i]));
2124
}
@@ -48,6 +51,9 @@ chrome.storage.onChanged.addListener(function(changes, areaName) {
4851
}
4952
});
5053

54+
/**
55+
* Load stored user rules
56+
**/
5157
var getStoredUserRules = function() {
5258
var oldUserRuleString = localStorage.getItem(USER_RULE_KEY);
5359
var oldUserRules = [];
@@ -57,6 +63,10 @@ var getStoredUserRules = function() {
5763
return oldUserRules;
5864
};
5965
var wr = chrome.webRequest;
66+
67+
/**
68+
* Load all stored user rules
69+
*/
6070
var loadStoredUserRules = function() {
6171
var rules = getStoredUserRules();
6272
var i;
@@ -68,7 +78,10 @@ var loadStoredUserRules = function() {
6878

6979
loadStoredUserRules();
7080

71-
// Set the icon color correctly
81+
/**
82+
* Set the icon color correctly
83+
* Depending on http-nowhere it should be red/default
84+
*/
7285
var setIconColor = function() {
7386
var newIconPath = httpNowhereOn ? './icon38-red.png' : './icon38.png';
7487
chrome.browserAction.setIcon({
@@ -88,7 +101,11 @@ for (r in rs) {
88101
}
89102
*/
90103

91-
104+
/**
105+
* Adds a new user rule
106+
* @param params: params defining the rule
107+
* @param cb: Callback to call after success/fail
108+
* */
92109
var addNewRule = function(params, cb) {
93110
if (all_rules.addUserRule(params)) {
94111
// If we successfully added the user rule, save it in local
@@ -106,6 +123,9 @@ var addNewRule = function(params, cb) {
106123
}
107124
};
108125

126+
/**
127+
* Adds a listener for removed tabs
128+
* */
109129
function AppliedRulesets() {
110130
this.active_tab_rules = {};
111131

@@ -147,6 +167,11 @@ var domainBlacklist = {};
147167
// TODO: Remove this code if they ever give us a real counter
148168
var redirectCounter = {};
149169

170+
/**
171+
* Called before a HTTP(s) request. Does the heavy lifting
172+
* Cancels the request/redirects it to HTTPS. URL modification happens in here.
173+
* @param details of the handler, see Chrome doc
174+
* */
150175
function onBeforeRequest(details) {
151176
var uri = document.createElement('a');
152177
uri.href = details.url;
@@ -254,8 +279,17 @@ var activeTypes = { stylesheet: 1, script: 1, object: 1, other: 1};
254279
// UI treatment of insecure subframes.
255280
var passiveTypes = { main_frame: 1, sub_frame: 1, image: 1, xmlhttprequest: 1};
256281

257-
// Record a non-HTTPS URL loaded by a given hostname in the Switch Planner, for
258-
// use in determining which resources need to be ported to HTTPS.
282+
/**
283+
* Record a non-HTTPS URL loaded by a given hostname in the Switch Planner, for
284+
* use in determining which resources need to be ported to HTTPS.
285+
* (Reminder: Switch planner is the pro-tool enabled by switching into debug-mode)
286+
*
287+
* @param type: type of the resource (see activeTypes and passiveTypes arrays)
288+
* @param tab_id: The id of the tab
289+
* @param resource_host: The host of the original url
290+
* @param resource_url: the original url
291+
* @param rewritten_url: The url rewritten to
292+
* */
259293
function writeToSwitchPlanner(type, tab_id, resource_host, resource_url, rewritten_url) {
260294
var rw = "rw";
261295
if (rewritten_url == null)
@@ -284,8 +318,11 @@ function writeToSwitchPlanner(type, tab_id, resource_host, resource_url, rewritt
284318
switchPlannerInfo[tab_id][rw][resource_host][active_content][resource_url] = 1;
285319
}
286320

287-
// Return the number of properties in an object. For associative maps, this is
288-
// their size.
321+
/**
322+
* Return the number of properties in an object. For associative maps, this is
323+
* their size.
324+
* @param obj: object to calc the size for
325+
* */
289326
function objSize(obj) {
290327
if (typeof obj == 'undefined') return 0;
291328
var size = 0, key;
@@ -295,8 +332,10 @@ function objSize(obj) {
295332
return size;
296333
}
297334

298-
// Make an array of asset hosts by score so we can sort them,
299-
// presenting the most important ones first.
335+
/**
336+
* Make an array of asset hosts by score so we can sort them,
337+
* presenting the most important ones first.
338+
* */
300339
function sortSwitchPlanner(tab_id, rewritten) {
301340
var asset_host_list = [];
302341
if (typeof switchPlannerInfo[tab_id] === 'undefined' ||
@@ -315,7 +354,9 @@ function sortSwitchPlanner(tab_id, rewritten) {
315354
return asset_host_list;
316355
}
317356

318-
// Format the switch planner output for presentation to a user.
357+
/**
358+
* Format the switch planner output for presentation to a user.
359+
* */
319360
function switchPlannerSmallHtmlSection(tab_id, rewritten) {
320361
var asset_host_list = sortSwitchPlanner(tab_id, rewritten);
321362
if (asset_host_list.length == 0) {
@@ -342,6 +383,9 @@ function switchPlannerSmallHtmlSection(tab_id, rewritten) {
342383
return output;
343384
}
344385

386+
/**
387+
* Create switch planner sections
388+
* */
345389
function switchPlannerRenderSections(tab_id, f) {
346390
return "Unrewritten HTTP resources loaded from this tab (enable HTTPS on " +
347391
"these domains and add them to HTTPS Everywhere):<br/>" +
@@ -351,10 +395,17 @@ function switchPlannerRenderSections(tab_id, f) {
351395
f(tab_id, "rw");
352396
}
353397

398+
/**
399+
* Generate the small switch planner html content
400+
* */
354401
function switchPlannerSmallHtml(tab_id) {
355402
return switchPlannerRenderSections(tab_id, switchPlannerSmallHtmlSection);
356403
}
357404

405+
/**
406+
* Generate a HTML link from urls in map
407+
* map: the map containing the urls
408+
* */
358409
function linksFromKeys(map) {
359410
if (typeof map == 'undefined') return "";
360411
var output = "";
@@ -366,10 +417,16 @@ function linksFromKeys(map) {
366417
return output;
367418
}
368419

420+
/**
421+
* Generate the detailed html fot the switch planner
422+
* */
369423
function switchPlannerDetailsHtml(tab_id) {
370424
return switchPlannerRenderSections(tab_id, switchPlannerDetailsHtmlSection);
371425
}
372426

427+
/**
428+
* Generate the detailed html fot the switch planner, by section
429+
* */
373430
function switchPlannerDetailsHtmlSection(tab_id, rewritten) {
374431
var asset_host_list = sortSwitchPlanner(tab_id, rewritten);
375432
var output = "";
@@ -393,6 +450,10 @@ function switchPlannerDetailsHtmlSection(tab_id, rewritten) {
393450
return output;
394451
}
395452

453+
/**
454+
* monitor cookie changes. Automatically convert them to secure cookies
455+
* @param changeInfo Cookie changed info, see Chrome doc
456+
* */
396457
function onCookieChanged(changeInfo) {
397458
if (!changeInfo.removed && !changeInfo.cookie.secure) {
398459
if (all_rules.shouldSecureCookie(changeInfo.cookie, false)) {
@@ -424,6 +485,10 @@ function onCookieChanged(changeInfo) {
424485
}
425486
}
426487

488+
/**
489+
* handling redirects, breaking loops
490+
* @param details details for the redirect (see chrome doc)
491+
* */
427492
function onBeforeRedirect(details) {
428493
// Catch redirect loops (ignoring about:blank, etc. caused by other extensions)
429494
var prefix = details.redirectUrl.substring(0, 5);
@@ -438,6 +503,7 @@ function onBeforeRedirect(details) {
438503
}
439504
}
440505

506+
// Registers the handler for requests
441507
wr.onBeforeRequest.addListener(onBeforeRequest, {urls: ["https://*/*", "http://*/*"]}, ["blocking"]);
442508

443509
// Try to catch redirect loops on URLs we've redirected to HTTPS.
@@ -447,12 +513,20 @@ wr.onBeforeRedirect.addListener(onBeforeRedirect, {urls: ["https://*/*"]});
447513
// Listen for cookies set/updated and secure them if applicable. This function is async/nonblocking.
448514
chrome.cookies.onChanged.addListener(onCookieChanged);
449515

516+
/**
517+
* disable switch Planner
518+
* @param tabId the Tab to disable for
519+
*/
450520
function disableSwitchPlannerFor(tabId) {
451521
delete switchPlannerEnabledFor[tabId];
452522
// Clear stored URL info.
453523
delete switchPlannerInfo[tabId];
454524
}
455525

526+
/**
527+
* Enable switch planner for specific tab
528+
* @param tabId the tab to enable it for
529+
*/
456530
function enableSwitchPlannerFor(tabId) {
457531
switchPlannerEnabledFor[tabId] = true;
458532
}

0 commit comments

Comments
 (0)