Skip to content

Commit 930ddb4

Browse files
committed
Merge branch 'master' into getbrowserforchannel
Conflicts: https-everywhere-tests/test_profile_skeleton/prefs.js src/components/ssl-observatory.js
2 parents 27b0f73 + 310e6d6 commit 930ddb4

File tree

462 files changed

+9735
-2668
lines changed

Some content is hidden

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

462 files changed

+9735
-2668
lines changed

chromium/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@
3838
"<all_urls>"
3939
],
4040
"update_url": "https://www.eff.org/files/https-everywhere-chrome-updates.xml",
41-
"version": "2014.4.16"
41+
"version": "2014.11.25"
4242
}

chromium/rules.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ RuleSets.prototype = {
249249
// Check to see if the Cookie object c meets any of our cookierule citeria
250250
// for being marked as secure. knownHttps is true if the context for this
251251
// cookie being set is known to be https.
252-
//log(DBUG, "Testing cookie:");
253-
//log(DBUG, " name: " + cookie.name);
254-
//log(DBUG, " host: " + cookie.host);
255-
//log(DBUG, " domain: " + cookie.domain);
256-
//log(DBUG, " rawhost: " + cookie.rawHost);
257252
var hostname = cookie.domain;
258253
// cookie domain scopes can start with .
259254
while (hostname.charAt(0) == ".")
@@ -272,10 +267,6 @@ RuleSets.prototype = {
272267
if (cr.host_c.test(cookie.domain) && cr.name_c.test(cookie.name)) {
273268
return ruleset;
274269
}
275-
//log(WARN, "no match domain " + cr.host_c.test(cookie.domain) +
276-
// " name " + cr.name_c.test(cookie.name));
277-
//log(WARN, "with " + cookie.domain + " " + cookie.name);
278-
//log(WARN, "and " + cr.host + " " + cr.name);
279270
}
280271
}
281272
}

https-everywhere-tests/test_profile_skeleton/prefs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ user_pref("extensions.https_everywhere._observatory.popup_shown", true);
55
user_pref("extensions.https_everywhere.toolbar_hint_shown", true);
66
// Show all logs.
77
user_pref("extensions.https_everywhere.LogLevel", 0);
8+
user_pref("extensions.https_everywhere.log_to_stdout", true);
89
// Allow running of Mixed Content Blocking tests.
910
user_pref("extensions.https_everywhere.show_ruleset_tests", true);
1011
// Make it quicker to make manual config changes.

makexpi.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ APP_NAME=https-everywhere
1717

1818
cd "`dirname $0`"
1919
RULESETS_SQLITE="$PWD/src/defaults/rulesets.sqlite"
20+
ANDROID_APP_ID=org.mozilla.firefox
2021

2122
[ -d pkg ] || mkdir pkg
2223

@@ -153,6 +154,7 @@ fi
153154

154155
cd src
155156

157+
156158
# Build the XPI!
157159
rm -f "../$XPI_NAME"
158160
#zip -q -X -9r "../$XPI_NAME" . "-x@../.build_exclusions"
@@ -167,6 +169,21 @@ else
167169
echo >&2 "Total included rules: `sqlite3 $RULESETS_SQLITE 'select count(*) from rulesets'`"
168170
echo >&2 "Rules disabled by default: `find chrome/content/rules -name "*.xml" | xargs grep -F default_off | wc -l`"
169171
echo >&2 "Created $XPI_NAME"
172+
173+
# Push to Android Firefox if device is connected
174+
# XXX on some systems, adb may require sudo...
175+
if type adb > /dev/null && adb devices > /dev/null 2>/dev/null ; then
176+
ADB_FOUND=`adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
177+
if [ "$ADB_FOUND" != "List of devices attached" ]; then
178+
echo Pushing "$XPI_NAME" to /sdcard/"$XPI_NAME"
179+
adb push "../$XPI_NAME" /sdcard/"$XPI_NAME"
180+
adb shell am start -a android.intent.action.VIEW \
181+
-c android.intent.category.DEFAULT \
182+
-d file:///mnt/sdcard/"$XPI_NAME" \
183+
-n $ANDROID_APP_ID/.App
184+
fi
185+
fi
186+
170187
if [ -n "$BRANCH" ]; then
171188
cd ../..
172189
cp $SUBDIR/$XPI_NAME pkg

src/Changelog

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
Institute of GB, Wall Street Journal
1717

1818
4.0.1 (2014-09-11)
19-
2019
* Significant new coverage: Reddit, Quora
2120
* Fixes include:
2221
Frontier Networks, Hotmail / Live, Microsoft, Mozilla, Ohio State, Rackspace, SJ.se, Timbo.se

src/chrome.manifest

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ contract @eff.org/https-everywhere;1 {32c165b4-fe5e-4964-9250-603c410631b4}
4242

4343
category profile-after-change HTTPSEverywhere @eff.org/https-everywhere;1
4444

45-
overlay chrome://browser/content/browser.xul chrome://https-everywhere/content/toolbar_button.xul
46-
overlay chrome://navigator/content/navigator.xul chrome://https-everywhere/content/toolbar_button.xul
45+
# XUL gets included in every non-mobile build
46+
# Android has some non-XUL UI that is loaded from the
47+
# sessionstore-windows-restored observer in https-everywhere.js
48+
overlay chrome://browser/content/browser.xul chrome://https-everywhere/content/toolbar_button.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={3550f703-e582-4d05-9a08-453d09bdfdc6} application={a79fe89b-6662-4ff4-8e88-09950ad4dfde}
49+
overlay chrome://navigator/content/navigator.xul chrome://https-everywhere/content/toolbar_button.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={3550f703-e582-4d05-9a08-453d09bdfdc6} application={a79fe89b-6662-4ff4-8e88-09950ad4dfde}
4750

4851
style chrome://global/content/customizeToolbar.xul chrome://https-everywhere/skin/https-everywhere.css
49-
component {0f9ab521-986d-4ad8-9c1f-6934e195c15c} components/ssl-observatory.js
50-
contract @eff.org/ssl-observatory;1 {0f9ab521-986d-4ad8-9c1f-6934e195c15c}
5152

52-
category profile-after-change SSLObservatory @eff.org/ssl-observatory;1
53+
# Observatory does not yet have mobile-friendly UI
54+
component {0f9ab521-986d-4ad8-9c1f-6934e195c15c} components/ssl-observatory.js application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={3550f703-e582-4d05-9a08-453d09bdfdc6} application={a79fe89b-6662-4ff4-8e88-09950ad4dfde}
55+
contract @eff.org/ssl-observatory;1 {0f9ab521-986d-4ad8-9c1f-6934e195c15c} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={3550f703-e582-4d05-9a08-453d09bdfdc6} application={a79fe89b-6662-4ff4-8e88-09950ad4dfde}
56+
category profile-after-change SSLObservatory @eff.org/ssl-observatory;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={3550f703-e582-4d05-9a08-453d09bdfdc6} application={a79fe89b-6662-4ff4-8e88-09950ad4dfde}
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
const CC = Components.classes;
2+
const CI = Components.interfaces;
3+
const CU = Components.utils;
4+
5+
var HTTPSEverywhere = CC["@eff.org/https-everywhere;1"]
6+
.getService(CI.nsISupports).wrappedJSObject;
7+
8+
CU.import("resource://gre/modules/Prompt.jsm");
9+
10+
var menuId;
11+
var urlbarId;
12+
var aWindow = getWindow();
13+
14+
15+
/*
16+
* Setup/Teardown for the UI
17+
*/
18+
19+
function loadIntoWindow() {
20+
if (!aWindow) {
21+
return;
22+
}
23+
var enabled = HTTPSEverywhere.prefs.getBoolPref("globalEnabled");
24+
addToggleItemToMenu(enabled);
25+
if (enabled) {
26+
urlbarId = aWindow.NativeWindow.pageactions.add(urlbarOptions);
27+
} else if (urlbarId) {
28+
aWindow.NativeWindow.pageactions.remove(urlbarId);
29+
}
30+
}
31+
32+
function unloadFromWindow() {
33+
if (!aWindow) {
34+
return;
35+
}
36+
aWindow.NativeWindow.menu.remove(menuId);
37+
aWindow.NativeWindow.pageactions.remove(urlbarId);
38+
}
39+
40+
41+
/*
42+
* Add a menu item to toggle HTTPS Everywhere
43+
*/
44+
45+
function addToggleItemToMenu(enabled) {
46+
if (menuId) { aWindow.NativeWindow.menu.remove(menuId); }
47+
var menuLabel = enabled ? "HTTPS Everywhere on" : "HTTPS Everywhere off";
48+
menuId = aWindow.NativeWindow.menu.add(menuLabel, null, function() {
49+
popupToggleMenu(aWindow, enabled);
50+
});
51+
}
52+
53+
function popupToggleMenu(aWindow, enabled) {
54+
var buttons = [
55+
{
56+
label: "Yes",
57+
callback: function() {
58+
toggleEnabledState();
59+
var msg = enabled ? "HTTPS Everywhere disabled!" : "HTTPS Everywhere enabled!";
60+
aWindow.NativeWindow.toast.show(msg, "short");
61+
return true;
62+
}
63+
}, {
64+
label: "No",
65+
callback: function() { return false; }
66+
}
67+
];
68+
var newState = enabled ? "off?" : "on?";
69+
aWindow.NativeWindow.doorhanger.show("Would you like to turn HTTPS Everywhere "+newState,
70+
"doorhanger-toggle", buttons);
71+
}
72+
73+
74+
/*
75+
* The HTTPS Everywhere icon in the URL bar shows a popup of rules that the
76+
* user can activate/deactivate. On long click, reset all rules to defaults.
77+
*/
78+
79+
var popupInfo = {
80+
rules: [],
81+
ruleItems: [],
82+
ruleStatus: [],
83+
alist: null,
84+
getApplicableList: function() {
85+
var browser = aWindow.BrowserApp.selectedBrowser;
86+
return HTTPSEverywhere.getApplicableListForBrowser(browser);
87+
},
88+
fill: function() {
89+
this.clear();
90+
this.alist = this.getApplicableList();
91+
HTTPSEverywhere.log(4,"applicable list active: "+JSON.stringify(this.alist.active));
92+
HTTPSEverywhere.log(4,"applicable list inactive: "+JSON.stringify(this.alist.inactive));
93+
for (var rule in this.alist.all) {
94+
if (this.alist.active.hasOwnProperty(rule)) {
95+
// active rules are checked and toggleable
96+
this.ruleItems.push({ label: rule, selected: true });
97+
this.ruleStatus.push(true);
98+
this.rules.push(this.alist.active[rule]);
99+
} else if (this.alist.moot.hasOwnProperty(rule)) {
100+
// moot rules are checked and toggleable too
101+
this.ruleItems.push({ label: rule, selected: true });
102+
this.ruleStatus.push(true);
103+
this.rules.push(this.alist.moot[rule]);
104+
} else if (this.alist.inactive.hasOwnProperty(rule)) {
105+
// inactive rules are unchecked and toggleable
106+
this.ruleItems.push({ label: rule });
107+
this.ruleStatus.push(false);
108+
this.rules.push(this.alist.inactive[rule]);
109+
} else if (this.alist.breaking.hasOwnProperty(rule)) {
110+
// breaking rules are get a unicode clockwise arrow next to them
111+
var ruleLabel = "\u21B7"+rule;
112+
var isSelected = this.alist.breaking[rule].active;
113+
this.ruleItems.push({ label: ruleLabel, selected: isSelected });
114+
this.ruleStatus.push(isSelected);
115+
this.rules.push(this.alist.breaking[rule]);
116+
}
117+
}
118+
},
119+
clear: function() {
120+
this.rules = [];
121+
this.ruleItems = [];
122+
this.ruleStatus = [];
123+
this.alist = {};
124+
}
125+
};
126+
127+
var urlbarOptions = {
128+
129+
title: "HTTPS Everywhere",
130+
131+
icon: "chrome://https-everywhere/skin/https-everywhere-128.png",
132+
133+
clickCallback: function() {
134+
popupInfo.fill();
135+
rulesPrompt.setMultiChoiceItems(popupInfo.ruleItems);
136+
rulesPrompt.show(function(data) {
137+
var db = data.button;
138+
if (db === -1) { return null; } // user didn't click the accept button
139+
if (popupInfo.rules.length !== db.length) {
140+
// Why does db sometimes have an extra entry that doesn't correspond
141+
// to any of the ruleItems? No idea, but let's log it.
142+
HTTPSEverywhere.log(5,"Got length mismatch between popupInfo.ruleItems and data.button");
143+
HTTPSEverywhere.log(4,"Applicable rules: "+JSON.stringify(popupInfo.rules));
144+
HTTPSEverywhere.log(4, "data.button: "+JSON.stringify(db));
145+
}
146+
for (var i=0; i<popupInfo.rules.length; i++) {
147+
if (popupInfo.ruleStatus[i] !== db[i]) {
148+
HTTPSEverywhere.log(4, "toggling: "+JSON.stringify(popupInfo.rules[i]));
149+
popupInfo.rules[i].toggle();
150+
}
151+
}
152+
reloadTab();
153+
return null;
154+
});
155+
},
156+
157+
longClickCallback: function() { popupResetDefaultsMenu(aWindow); }
158+
};
159+
160+
var rulesPrompt = new Prompt({
161+
window: aWindow,
162+
title: "Enable/disable rules",
163+
buttons: ["Apply changes"]
164+
});
165+
166+
function popupResetDefaultsMenu(aWindow) {
167+
var buttons = [
168+
{
169+
label: "Yes",
170+
callback: function() {
171+
resetToDefaults();
172+
var msg = "Default rules reset.";
173+
aWindow.NativeWindow.toast.show(msg, "short");
174+
return true;
175+
}
176+
}, {
177+
label: "No",
178+
callback: function() { return false; }
179+
}
180+
];
181+
aWindow.NativeWindow.doorhanger.show("Reset all HTTPS Everywhere rules to defaults?",
182+
"doorhanger-reset", buttons);
183+
}
184+
185+
186+
/*
187+
* Some useful utils
188+
*/
189+
190+
function reloadTab() {
191+
// There seems to be no API to do this directly?
192+
aWindow.BrowserApp.selectedTab.window.location.reload();
193+
}
194+
195+
function toggleEnabledState(){
196+
HTTPSEverywhere.toggleEnabledState();
197+
loadIntoWindow();
198+
reloadTab();
199+
}
200+
201+
function resetToDefaults() {
202+
HTTPSEverywhere.https_rules.resetRulesetsToDefaults();
203+
reloadTab();
204+
}
205+
206+
function getWindow() {
207+
return CC['@mozilla.org/appshell/window-mediator;1']
208+
.getService(CI.nsIWindowMediator)
209+
.getMostRecentWindow('navigator:browser');
210+
}
211+
212+
213+
/*
214+
* Here's the external API to this UI module
215+
*/
216+
217+
var AndroidUI = {
218+
init: function() {
219+
loadIntoWindow();
220+
},
221+
shutdown: function() {
222+
unloadFromWindow();
223+
}
224+
};
225+
226+
var EXPORTED_SYMBOLS = ["AndroidUI"];

src/chrome/content/code/ChannelReplacement.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,8 @@ ChannelReplacement.prototype = {
8181

8282
newChan.loadGroup = chan.loadGroup;
8383
newChan.notificationCallbacks = chan.notificationCallbacks;
84-
85-
// The following line has been commented out, because it appears to interfere with the Flash plugin.
86-
// For example, on https://www.youtube.com, if the LOAD_REPLACE flag is included in newChan's
87-
// loadFlag, the Flash plugin reports an error and video streaming does not take place.
88-
// By removing this flag, we allow Flash to see the "originalURI" attirubte of newChan,
89-
// which contains the HTTP (non-HTTPS) URL that Flash requested before HTTPS-Everywhere
90-
// redirected the channel.
91-
// XXX: May have unintended side effects. Needs more investigation.
92-
//
93-
// newChan.loadFlags = loadFlags | newChan.LOAD_REPLACE;
94-
95-
newChan.loadFlags = loadFlags;
96-
84+
newChan.loadFlags = loadFlags | newChan.LOAD_REPLACE;
85+
9786
if (!(newChan instanceof Ci.nsIHttpChannel))
9887
return this;
9988

0 commit comments

Comments
 (0)