Skip to content

Commit e7baaa3

Browse files
committed
UI now controls Observatory enablement + anonymity
1 parent 3e00627 commit e7baaa3

File tree

4 files changed

+38
-13
lines changed

4 files changed

+38
-13
lines changed

src/chrome/content/observatory-preferences.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,27 @@ obsprefs = ssl_observatory.prefs;
1313
const pref_prefix = "extensions.ssl_observatory.";
1414

1515
function observatory_prefs_init(doc) {
16+
// Is the Observatory on?
1617
var enabled = obsprefs.getBoolPref("extensions.https_everywhere._observatory_prefs.enabled");
1718
document.getElementById("use-observatory").checked = enabled;
1819
set_observatory_configurability(enabled);
19-
// If the observatory is not yet on, and Tor is not available, the initial
20-
// option is to turn it on /without/ Tor
21-
if ((!ssl_observatory.torbutton_installed) && !enabled) {
22-
var nonanon_radio = document.getElementById("ssl-obs-nonanon");
23-
doc.getElementById("ssl-obs-how").selectedItem = nonanon_radio;
20+
21+
// More complicated: is it anonymised by Tor?
22+
var obs_how = doc.getElementById("ssl-obs-how");
23+
var anon_radio = document.getElementById("ssl-obs-anon");
24+
var nonanon_radio = document.getElementById("ssl-obs-nonanon");
25+
var anon = !obsprefs.getBoolPref(
26+
"extensions.https_everywhere._observatory_prefs.use_custom_proxy");
27+
28+
// first set the radios to match the current settings variables
29+
obs_how.selectedItem = (anon) ? anon_radio : nonanon_radio;
30+
31+
// But if the user hasn't turned the observatory on,
32+
// the default should be something maximally sensible
33+
var torbutton = ssl_observatory.torbutton_installed;
34+
if (!enabled) {
35+
set_obs_anon(torbutton);
36+
obs_how.selectedItem = (torbutton) ? anon_radio : nonanon_radio;
2437
}
2538
//scale_title_logo();
2639
}
@@ -32,9 +45,6 @@ function popup_done() {
3245
window.close();
3346
}
3447

35-
function enable_observatory() {
36-
obsprefs.setBoolPref("extensions.https_everywhere._observatory_prefs.enabled", true);
37-
}
3848

3949
function scale_title_logo() {
4050
// The image is naturally 500x207, but if it's shrunk we don't want it
@@ -85,6 +95,16 @@ function recursive_set(node, attrib, value) {
8595
recursive_set(node.childNodes[i], attrib, value)
8696
}
8797

98+
// called from the popup
99+
100+
function set_obs_anon(val) {
101+
obsprefs.setBoolPref( "extensions.https_everywhere._observatory_prefs.use_custom_proxy", !val);
102+
}
103+
function enable_observatory() {
104+
obsprefs.setBoolPref("extensions.https_everywhere._observatory_prefs.enabled", true);
105+
}
106+
107+
// called from within the prefs window, we have more work to do:
88108
function toggle_enabled() {
89109
var checkbox = document.getElementById("use-observatory");
90110
var use_obs = checkbox.checked;

src/chrome/content/observatory-preferences.xul

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@
2828
<separator class="thin" />
2929
<commandset>
3030
<command id="toggle-enabled" oncommand="toggle_enabled()" />
31+
<command id="use-obs-anon" oncommand="set_obs_anon(true)" />
32+
<command id="use-obs-nonanon" oncommand="set_obs_anon(false)" />
3133
</commandset>
3234
<checkbox label="&ssl-observatory.prefs.use;" id="use-observatory"
3335
command="toggle-enabled" style="font-size:1.5em;"/>
3436
<separator class="thin"/>
3537
<radiogroup style="margin-left:3em;" id="ssl-obs-how">
36-
<radio label="&ssl-observatory.prefs.anonymous;" selected="true"
38+
<radio label="&ssl-observatory.prefs.anonymous;"
3739
tooltiptext="&ssl-observatory.prefs.anonymous_tooltip;"
3840
alt_label="&ssl-observatory.prefs.anonymous_unavailable;"
41+
command="use-obs-anon"
3942
class="ssl-obs-conf" id="ssl-obs-anon"/>
4043
<radio label="&ssl-observatory.prefs.nonanon;"
4144
tooltiptext="&ssl-observatory.prefs.nonanon_tooltip;"
45+
command="use-obs-nonanon"
4246
class="ssl-obs-conf" id="ssl-obs-nonanon"/>
4347
</radiogroup>
4448
<separator class="thin"/>

src/chrome/locale/en/ssl-observatory.dtd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ intrusive corporate network:">
2929
intrusive corporate network that monitors your browsing with a TLS proxy
3030
and a private root Certificate Authority. If enabled on such a network,
3131
this option might publish evidence of which https:// domains were being
32-
visited through the proxy, because of the unique certificates it would
32+
visited through that proxy, because of the unique certificates it would
3333
produce. So we leave it off by default.">
3434

3535
<!ENTITY ssl-observatory.prefs.anonymous "Check certificates using Tor for anonymity">
3636
<!ENTITY ssl-observatory.prefs.anonymous_unavailable
3737
"Check certificates using Tor for anonymity (requires Torbutton)">
3838
<!ENTITY ssl-observatory.prefs.anonymous_tooltip
39-
"This option requires Torbutton to be installed">
39+
"This option requires Tor and Torbutton to be installed">
4040

4141
<!ENTITY ssl-observatory.prefs.asn
4242
'If you see a suspicious certificate, report which ISP you were connected to'>
@@ -54,7 +54,8 @@ lets us warn you about insecure connections or attacks on your browser.">
5454

5555
<!ENTITY ssl-observatory.prefs.explanation2
5656
"When you visit https://www.example.com, the Observatory will learn that
57-
somebody visited that site, but will not know who or what page they looked at.">
57+
somebody visited that site, but will not know who or what page they looked at.
58+
Mouseover the options for further details:">
5859

5960
<!ENTITY ssl-observatory.prefs.hide "Hide advanced options">
6061

src/defaults/preferences/preferences.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SSl Observatory preferences
2-
pref("extensions.https_everywhere._observatory_prefs.enabled",true);
2+
pref("extensions.https_everywhere._observatory_prefs.enabled",false);
33

44
// "testing" currently means send unecessary fingerprints and other test-suite
55
// type stuff

0 commit comments

Comments
 (0)