Skip to content

Commit 1fcb027

Browse files
committed
The SSL Observatory warning popup now contains some actual information.
1 parent d6700d7 commit 1fcb027

File tree

8 files changed

+49
-41
lines changed

8 files changed

+49
-41
lines changed

src/chrome/content/observatory-popup.xul

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
align="center"
1111
onload="document.getElementById('ask-me-later').focus()"
1212
>
13-
<script type="application/x-javascript" src="observatory-preferences.js" />
13+
<script type="application/x-javascript" src="observatory-xul.js" />
1414
<image src="chrome://https-everywhere/skin/ssl-observatory-messy.jpg" />
1515
<label style="padding:25px;">&ssl-observatory.popup.text;</label>
1616

src/chrome/content/observatory-preferences.xul

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
persist="screenX screenY"
1515
onload="observatory_prefs_init(document)"
1616
ondialogaccept="observatory_prefs_accept()">
17-
<script type="application/x-javascript" src="observatory-preferences.js" />
17+
<script type="application/x-javascript" src="observatory-xul.js" />
1818
<vbox flex="1">
1919
<spacer flex="1" />
2020
<hbox flex="1">

src/chrome/content/observatory-warning.xul

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
xmlns:html="http://www.w3.org/1999/xhtml"
77
title="&ssl-observatory.warning.title;"
88
align="center"
9-
onload="document.getElementById('ask-me-later').focus()"
9+
onload="warning_populate(window.arguments[0])"
1010
>
11-
<script type="application/x-javascript" src="observatory-preferences.js" />
11+
<script type="application/x-javascript" src="observatory-xul.js" />
1212
<image src="chrome://https-everywhere/skin/ssl-observatory-messy.jpg" />
13-
<label style="padding:25px;">EFF's SSL Observatory has issued a warning about the HTTPS certificiate(s) for this site</label>
14-
<separator class="thin"/>
15-
<label style="padding:25px;" id="warning-text"></label>
13+
<vbox id="warning-container" flex="1">
14+
<label style="padding:25px;">EFF's SSL Observatory has issued a warning about the HTTPS certificiate(s) for this site</label>
15+
<spacer flex="2" />
16+
</vbox>
1617

1718
<commandgroup>
1819
<command id="showcert" oncommand="window.close()" />
@@ -24,7 +25,7 @@
2425
<hbox>
2526
<spacer flex="2" />
2627
<button label="&ssl-observatory.warning.showcert;" accesskey="s"
27-
command='showcert'/>
28+
id="show-certificate" command='showcert'/>
2829
<spacer flex="1" />
2930
<button label="&ssl-observatory.warning.okay;" accesskey="o"
3031
command='okay'/>

src/chrome/content/observatory-preferences.js renamed to src/chrome/content/observatory-xul.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,17 @@ function observatory_prefs_accept() {
156156
return true; // https://developer.mozilla.org/en/XUL/dialog#a-ondialogaccept
157157
// also close things if there is no out meta prefs window
158158
}
159+
160+
function warning_populate(warningObj) {
161+
// Fill in the SSL Observatory Warning labels...
162+
var container = document.getElementById("warning-container");
163+
for (var hash in warningObj) {
164+
var label=document.createElement("label");
165+
label.setAttribute("value",warningObj[hash].long_desc);
166+
label.setAttribute("style","padding:25px;");
167+
container.appendChild(label);
168+
var spacer=document.createElement("spacer");
169+
separator.setAttribute("flex","1");
170+
container.appendChild(spacer);
171+
}
172+
}

src/chrome/content/toolbar_button.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ INFO=3;
1010
NOTE=4;
1111
WARN=5;
1212

13+
HTTPSEverywhere = CC["@eff.org/https-everywhere;1"]
14+
.getService(Components.interfaces.nsISupports)
15+
.wrappedJSObject;
16+
1317
function https_everywhere_load() {
1418
// on first run, put the context menu in the addons bar
1519
try {
@@ -57,7 +61,6 @@ function show_applicable_list(menupopup) {
5761
return null;
5862
}
5963

60-
var HTTPSEverywhere = CC["@eff.org/https-everywhere;1"].getService(Components.interfaces.nsISupports).wrappedJSObject;
6164
var alist = HTTPSEverywhere.getExpando(domWin,"applicable_rules", null);
6265
var weird=false;
6366

@@ -73,19 +76,16 @@ function show_applicable_list(menupopup) {
7376

7477
function toggle_rule(rule_id) {
7578
// toggle the rule state
76-
var HTTPSEverywhere = CC["@eff.org/https-everywhere;1"]
77-
.getService(Components.interfaces.nsISupports)
78-
.wrappedJSObject;
7979
HTTPSEverywhere.https_rules.rulesetsByID[rule_id].toggle();
8080
var domWin = content.document.defaultView.top;
8181
/*if (domWin instanceof CI.nsIDOMWindow) {
8282
var alist = HTTPSEverywhere.getExpando(domWin,"applicable_rules", null);
8383
if (alist) alist.empty();
8484
}*/
85-
reload_window(HTTPSEverywhere);
85+
reload_window();
8686
}
8787

88-
function reload_window(HTTPSEverywhere) {
88+
function reload_window() {
8989
var domWin = content.document.defaultView.top;
9090
if (!(domWin instanceof CI.nsIDOMWindow)) {
9191
HTTPSEverywhere.log(WARN, domWin + " is not an nsIDOMWindow");
@@ -110,10 +110,3 @@ function open_in_tab(url) {
110110
var recentWindow = wm.getMostRecentWindow("navigator:browser");
111111
recentWindow.delayedOpenTab(url, null, null, null, null);
112112
}
113-
114-
function chrome_opener(uri) {
115-
// we don't use window.open, because we need to work around TorButton's state control
116-
CC['@mozilla.org/appshell/window-mediator;1'].getService(CI.nsIWindowMediator)
117-
.getMostRecentWindow('navigator:browser')
118-
.open(uri,'', 'chrome,centerscreen' );
119-
}

src/chrome/content/toolbar_button.xul

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
</toolbarpalette>
4444
<commandset>
4545
<command id="https-everywhere-menuitem-preferences"
46-
oncommand="chrome_opener('chrome://https-everywhere/content/preferences.xul');" />
46+
oncommand="HTTPSEverywhere.chrome_opener('chrome://https-everywhere/content/preferences.xul');" />
4747
<command id="https-everywhere-menuitem-about"
48-
oncommand="chrome_opener('chrome://https-everywhere/content/about.xul');" />
48+
oncommand="HTTPSEverywhere.chrome_opener('chrome://https-everywhere/content/about.xul');" />
4949
<command id="https-everywhere-menuitem-observatory"
50-
oncommand="chrome_opener('chrome://https-everywhere/content/observatory-preferences.xul');" />
50+
oncommand="HTTPSEverywhere.chrome_opener('chrome://https-everywhere/content/observatory-preferences.xul');" />
5151
<command id="https-everywhere-menuitem-donate-eff"
5252
oncommand="open_in_tab('https://www.eff.org/donate');" />
5353
<command id="https-everywhere-menuitem-donate-tor"

src/components/https-everywhere.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ HTTPSEverywhere.prototype = {
441441
var gbp = ssl_observatory.prefs.getBoolPref;
442442
var shown = gbp("extensions.https_everywhere._observatory.popup_shown");
443443
if (!shown && ssl_observatory.torbutton_installed)
444-
chrome_opener("chrome://https-everywhere/content/observatory-popup.xul");
444+
this.chrome_opener("chrome://https-everywhere/content/observatory-popup.xul");
445445
}
446446
return;
447447
},
@@ -561,19 +561,19 @@ HTTPSEverywhere.prototype = {
561561
} catch (e) {
562562
this.log(WARN, "Couldn't notify observers: " + e);
563563
}
564+
},
565+
566+
chrome_opener: function(uri) {
567+
// we don't use window.open, because we need to work around TorButton's
568+
// state control
569+
return CC['@mozilla.org/appshell/window-mediator;1']
570+
.getService(CI.nsIWindowMediator)
571+
.getMostRecentWindow('navigator:browser')
572+
.open(uri,'', 'chrome,centerscreen' );
564573
}
565574

566575
};
567576

568-
function chrome_opener(uri) {
569-
// we don't use window.open, because we need to work around TorButton's
570-
// state control
571-
return CC['@mozilla.org/appshell/window-mediator;1']
572-
.getService(CI.nsIWindowMediator)
573-
.getMostRecentWindow('navigator:browser')
574-
.open(uri,'', 'chrome,centerscreen' );
575-
}
576-
577577
var prefs = 0;
578578
var econsole = 0;
579579
function https_everywhereLog(level, str) {

src/components/ssl-observatory.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ SSLObservatory.prototype = {
394394
that.log(WARN, "The SSL Observatory has issued a warning about this certificate for " + domain);
395395
try {
396396
var warningObj = JSON.parse(req.responseText);
397-
this.warnUser(warningObj);
397+
that.warnUser(warningObj);
398398
} catch(e) {
399399
that.log(WARN, "Failed to process SSL Observatory cert warnings :( " + e);
400400
that.log(WARN, req.responseText);
@@ -417,14 +417,14 @@ SSLObservatory.prototype = {
417417
},
418418

419419
warnUser: function(warningObj) {
420-
var label = "";
421-
for (var hash in warningObj)
422-
label += warningObj[hash].long_desc;
423-
var wtext = chrome_opener("chrome://https-everywhere/content/observatory-warning.xul")
424-
.document.getElementById("warning-text");
425-
wtext.setAttribute("value", label);
420+
var aWin = CC['@mozilla.org/appshell/window-mediator;1']
421+
.getService(CI.nsIWindowMediator)
422+
.getMostRecentWindow('navigator:browser');
423+
aWin.openDialog("chrome://https-everywhere/content/observatory-warning.xul",
424+
"","chrome,centerscreen", warningObj);
426425
},
427426

427+
428428
getProxySettings: function() {
429429
var proxy_settings = ["direct", "", 0];
430430
if (this.torbutton_installed && this.myGetBoolPref("use_tor_proxy")) {

0 commit comments

Comments
 (0)