Skip to content

Commit 05c3865

Browse files
author
Micah Lee
committed
Preliminary ruleset test instructions, and made it so menu item only appears once
1 parent 100e980 commit 05c3865

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ To build the Chrome version go to the git repository root and run:
3737

3838
After building the extension the xpi files (for Firefox) and crx files (for Chrome) get created in the pkg directory. You can open those files within your browser to install the browser extension.
3939

40+
Ruleset Tests
41+
-------------
42+
43+
You can run ruleset tests by opening `about:config` and changing `extensions.https_everywhere.show_ruleset_tests` to true. Now when you open the HTTPS Everywhere context menu there will be a "Run HTTPS Everywhere Ruleset Tests" menu item.
44+
45+
When you run the tests, be prepared to let your computer run them for a really long time.
46+
4047
Source Tree
4148
-----------
4249

src/chrome/content/toolbar_button.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ function stitch_context_menu2() {
199199
}
200200
}
201201

202+
var rulesetTestsMenuItem = null;
203+
202204
function show_applicable_list(menupopup) {
203205
var domWin = content.document.defaultView.top;
204206
if (!(domWin instanceof CI.nsIDOMWindow)) {
@@ -220,14 +222,18 @@ function show_applicable_list(menupopup) {
220222

221223
// should we also show the ruleset tests menu item?
222224
if(HTTPSEverywhere.prefs.getBoolPref("show_ruleset_tests")) {
223-
let strings = document.getElementById('HttpsEverywhereStrings');
224-
let label = strings.getString('https-everywhere.menu.ruleset-tests');
225225

226-
let item = this.document.createElement('menuitem');
227-
item.setAttribute('command', 'https-everywhere-menuitem-ruleset-tests');
228-
item.setAttribute('label', label);
226+
if(!rulesetTestsMenuItem) {
227+
let strings = document.getElementById('HttpsEverywhereStrings');
228+
let label = strings.getString('https-everywhere.menu.ruleset-tests');
229+
230+
rulesetTestsMenuItem = this.document.createElement('menuitem');
231+
rulesetTestsMenuItem.setAttribute('command', 'https-everywhere-menuitem-ruleset-tests');
232+
rulesetTestsMenuItem.setAttribute('label', label);
233+
}
229234

230-
menupopup.appendChild(item);
235+
if(!menupopup.contains(rulesetTestsMenuItem))
236+
menupopup.appendChild(rulesetTestsMenuItem);
231237
}
232238

233239
}

0 commit comments

Comments
 (0)