Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
1a982d7
Merge pull request #11994 from Hainish/release-2017.8.19
Hainish Aug 19, 2017
3197d97
Create decentraleyes.org.xml (#11839)
Aug 20, 2017
e1352ad
Update and rename Discover-Magazine.xml to DiscoverMagazine.com.xml (…
Aug 20, 2017
66bceed
Create kitaabun.com.xml (#11844)
Aug 20, 2017
d2386d0
Create FederalShariatCourt.gov.pk.xml (#11847)
Aug 20, 2017
1f486b4
Create CedricVillani.org.xml (#11919)
Aug 20, 2017
f0db785
Create GenusDebatten.se.xml (#11927)
Aug 20, 2017
9ec1aa3
Delete Swiss-VA.com.xml (#11976)
Aug 20, 2017
ccf271f
Delete BitcoinStore.com.xml (#11881)
Aug 20, 2017
51b3909
Simplify MyUS.com.xml (#11627)
Aug 20, 2017
a17515b
add Incometaxindiaefiling.gov.in.xml (#11968)
J0WI Aug 20, 2017
956e60c
Re-enable and add Costco.xml to ruleset-whitelist.csv (#11133)
Aug 20, 2017
e4315ed
Add keyserver.ubuntu.com to Ubuntu.xml (#11995) (#12001)
Aug 20, 2017
26fab60
Update OpenSUSE.xml (#12004)
Aug 20, 2017
7f3a4a0
Update Nic.cz.xml (#12005)
Aug 20, 2017
872861a
Update Weibo.com.xml (#11928)
ivysrono Aug 20, 2017
f940c5e
Update QQ.xml (#12013)
ivysrono Aug 20, 2017
ae90128
Add keys.fedoraproject.org to Fedora_Project.org.xml (#11995) (#12003)
Aug 20, 2017
08a1135
Update/fix opencaching.pl.xml (#11991)
Rotzbua Aug 20, 2017
72ed543
Update opencaching.de.xml (#11990)
Rotzbua Aug 20, 2017
ef181f4
Update PopCash.net.xml (#11123)
Aug 20, 2017
fb641ef
Remove preloaded domains from PayPal.xml and move PayPal.co.uk into a…
Aug 20, 2017
55f8777
Update and rename Travis_CI.xml to Travis-CI.org.xml (#11431)
Aug 20, 2017
d6d4808
Added AfB. (#12012)
Jochen-A-Fuerbacher Aug 20, 2017
077c7b2
Updated menshealth.de. (#10838)
Jochen-A-Fuerbacher Aug 20, 2017
f723f76
Added elwis.de (#11956)
Jochen-A-Fuerbacher Aug 20, 2017
459e7d6
Added bafg.de (#11955)
Jochen-A-Fuerbacher Aug 20, 2017
431ec0a
Added DGzRS Die Seenotretter (#11861)
Jochen-A-Fuerbacher Aug 20, 2017
f120250
Added dts-nachrichtenagentur.de (#11957)
Jochen-A-Fuerbacher Aug 20, 2017
05a56c5
Added ajhackett.com (#11566)
Jochen-A-Fuerbacher Aug 20, 2017
ce9dcc7
Update OnlineSBI.com.xml (#11120)
Aug 20, 2017
bb37b86
Added bafin.de (#11958)
Jochen-A-Fuerbacher Aug 20, 2017
6199965
Update and rename Perform.xml to PerformGroup.com.xml (#11937)
Aug 20, 2017
fac4e1b
Create TheTrevorProject.org.xml (#11984)
Bisaloo Aug 20, 2017
196b5a8
Create ssi.gouv.fr.xml (#11985)
Bisaloo Aug 20, 2017
5279793
Create AMuseWiki.org.xml (#11999)
Bisaloo Aug 20, 2017
cc55eb4
[Zataz.com] Simplify and reactivate ruleset (#11833)
Bisaloo Aug 20, 2017
5eaffb4
[Ondarossa.info] Reactivate ruleset and remove platform (#11607)
Bisaloo Aug 20, 2017
06450f6
[Directbox] Remove right wildcard and reactivate ruleset (#11246)
Bisaloo Aug 20, 2017
81789b9
Added rechenkraft.net (#11393)
Jochen-A-Fuerbacher Aug 20, 2017
f0f755c
Create BitMitigate.com.xml (#12010)
Aug 20, 2017
aa8b522
Create 50gameslike.com.xml (#12007)
Aug 20, 2017
dc1e728
Added rules for technik-museum.de. (#10167)
Jochen-A-Fuerbacher Aug 20, 2017
828c815
Update Groupon.com.xml (#10836)
Aug 20, 2017
3c49804
Update SPL_Center.org.xml (#11917)
Aug 20, 2017
9fed562
[Mendeley.com] Update and reactivate ruleset (#11613)
Bisaloo Aug 20, 2017
eaca53b
Updated theanarchistlibrary (#11966)
Aug 20, 2017
845c690
Create Massengeschmack.tv (#7271)
Mertsch Aug 20, 2017
4c767ef
Create alayam24.com.xml (#11920)
Aug 20, 2017
44262ee
Create al-sunan.net.xml (#11845)
Aug 20, 2017
c75ca94
Update Flipkart.com.xml (#11969)
J0WI Aug 20, 2017
454fb4a
[Pinterest] Remove preloaded ruleset. (#11693)
bardiharborow Aug 20, 2017
4964511
Update https_everywhere_checker/check_rules.py, Fix #10877 (#11187)
Aug 22, 2017
4641825
Update utils/ruleset-whitelist.csv, Related #11187 (#11597)
Aug 22, 2017
6e89bb2
[Gyazo.com] Add targets (#12058)
Bisaloo Aug 23, 2017
dac62c9
Standardizing 2-space indentation for chromium/ path
Hainish Aug 24, 2017
91febbf
Standardizing 2-space indentation for rest of the project
Hainish Aug 24, 2017
e373c18
Specify 2-space indentation for js in .editorconfig
Hainish Aug 24, 2017
5ed9499
[Smithsonianmag.com] Simplify ruleset and add test urls (fix #10705) …
Bisaloo Aug 24, 2017
5e87f78
Delete RAUR.xml (Gone from DNS) (#11915)
Aug 24, 2017
2ff7e87
Delete Northern-Indymedia.org.xml (cacert) (#11700)
Aug 24, 2017
61229ab
[Federal_Trade_Commission] Reactivate ruleset. (#11085)
bardiharborow Aug 24, 2017
1cbecfe
[adfoc.us] Add ruleset. (#11081)
bardiharborow Aug 24, 2017
7eacfd4
[Aulo.in] Cleanup and reactivate. (#10938)
bardiharborow Aug 24, 2017
6f9536e
[Twitter-Counter] Update and de-whitelist rule. (#11697)
bardiharborow Aug 24, 2017
88632ca
Create ogdb.eu.xml (#12017)
christianheinrichs Aug 24, 2017
7c9197c
Delete POP.xml (#11887)
Aug 24, 2017
2dca9c1
Create PCPD.org.hk.xml (#9799)
Aug 24, 2017
f12708c
Create SPCA.org.hk.xml (#9798)
Aug 24, 2017
8024741
Create hkicl.com.hk.xml (#8117)
Aug 24, 2017
12ffb46
Create Un4seen.com.xml (#12023)
Aug 24, 2017
b285796
Re-activate and Update University_of_Tennessee_Knoxville.xml (#10275)
Aug 24, 2017
efd1c20
add test urls to the Meetrics ruleset (#11284)
numismatika Aug 24, 2017
065938a
Create https.cat.xml (#12067)
Aug 24, 2017
357500a
add rule for SphereUp.com (#11858)
numismatika Aug 24, 2017
3e3d8f5
add rule for Whitepaper DB GmbH (#11859)
numismatika Aug 24, 2017
ca2035c
add rule for VisualDNA (#11925)
numismatika Aug 24, 2017
25103bf
[Volgistics.com] Simplify ruleset (#12055)
Bisaloo Aug 24, 2017
785eaac
Create RegardsCitoyens.fr.xml (#11815)
Bisaloo Aug 24, 2017
0ba83bc
[PrintFriendly.com] Simplify ruleset (#11540)
Bisaloo Aug 24, 2017
5ea7c81
[BestOliveOils.com] Simplify ruleset (#11549)
Bisaloo Aug 24, 2017
6a851c8
Delete Bretagne-web.eu.xml (#11518)
Bisaloo Aug 24, 2017
c531d94
Delete T411.xml (#11517)
Bisaloo Aug 24, 2017
93211bf
Delete ScriptObservatory.org.xml (#11467)
Bisaloo Aug 24, 2017
822b49b
[Spice-space.org] Reactivate ruleset (#11524)
Bisaloo Aug 24, 2017
174b86a
[FreeUtopia.org] Simplify and activate ruleset (#11522)
Bisaloo Aug 24, 2017
372e995
[De-centralize.com] Reactivate ruleset (#11521)
Bisaloo Aug 24, 2017
8022d4e
[CJS-CDKeys.com] Merge rulesets (#11468)
Bisaloo Aug 24, 2017
3410367
[Svbtle.com] Simplify ruleset and add test urls (#11563)
Bisaloo Aug 24, 2017
5c9b91a
[UMW.edu] Remove wildcard (#11381)
Bisaloo Aug 24, 2017
006b6bd
Create Skins.cash.xml (#12027)
Aug 24, 2017
1f48efb
Update and rename KF_Webs.net.xml to KFWebs.net.xml (#12032)
Aug 24, 2017
71b4fe4
Update Freie-Universitat-Berlin.xml (#12030)
Aug 24, 2017
3f1e5b6
[Amahi.org] Remove wildcard and reactivate ruleset (#11490)
Bisaloo Aug 24, 2017
00277f9
[HRW.org] Reactivate ruleset (#11515)
Bisaloo Aug 24, 2017
77ad7fd
[Vates.fr] Reactivate ruleset (#11320)
Bisaloo Aug 24, 2017
f5faaf1
[LUGoNS.org] Update and reactivate ruleset (#11062)
Bisaloo Aug 24, 2017
2ba1086
[Lithium-clients] Remove broken target (#11323)
Bisaloo Aug 24, 2017
1be7bee
Create IRIS.edu.xml (#10892)
Bisaloo Aug 24, 2017
5c4d1bf
[MyFBO.com] Remove wildcard (#11508)
Bisaloo Aug 24, 2017
6517f0f
[OsmAnd.net] Update and reactivate ruleset (#10722)
Bisaloo Aug 24, 2017
5f5c151
[Centrify.com] Update and reactivate ruleset (#11558)
Bisaloo Aug 24, 2017
b997262
Create CSGO-Skins.com.xml (#12024)
Aug 24, 2017
3914aeb
Create CSGOStash.com.xml (#12025)
Aug 24, 2017
7804d5a
Create CSGOItems.pro.xml (#12026)
Aug 24, 2017
f770c84
[SnapEngage.com] Simplify, reactivate and merge rulesets (#11372)
Bisaloo Aug 24, 2017
cf30dcc
Update NIIF.xml (#12034)
Aug 24, 2017
716d9ed
[Thumbshots] Simplify ruleset (#11765)
Bisaloo Aug 24, 2017
7337f8b
Update GeForce.com.xml (#11545)
Aug 25, 2017
5a5fe24
Update Secure-u.de.xml (#12036)
Aug 25, 2017
b67f7cd
Update and rename Calyx-Institute.xml to CalyxInstitute.xml (#12029)
Aug 25, 2017
6eeacfc
Create SpaceBattles.com.xml (#12051)
Aug 25, 2017
64599f8
Update 163.com.xml (#12066)
ivysrono Aug 25, 2017
f4063d8
snta.ru (#11890)
galeksandrp Aug 25, 2017
ea89119
bicotender.ru (#11891)
galeksandrp Aug 25, 2017
4b1f2ef
meb-biz.ru (#11888)
galeksandrp Aug 25, 2017
0ecffae
stylershop.ru (#11899)
galeksandrp Aug 25, 2017
8781de4
Show icon badge (without unrelated changes) (#12073)
Aug 25, 2017
e4620f3
avto.ru (#11897)
galeksandrp Aug 25, 2017
ae498ec
Update University-of-Cambridge.xml (#11825)
Aug 25, 2017
a981645
Create FLOSS-Shop.de.xml and Delete Kernel_concepts.xml (cacert) (#1…
Aug 25, 2017
b916a33
Create 6Scan_Security.com.xml and Delete 6Scan.com.xml (#11452)
Aug 25, 2017
2cce6b5
Re-activate, Rename and Update Duke.edu.xml (#10102)
Aug 25, 2017
bc54249
Update Michal_Hrusecky.xml (#11430)
Aug 25, 2017
d0ae3ae
[CakeCentral.com] Simplify ruleset (#11542)
Bisaloo Aug 25, 2017
be6c0db
Simplify FinancialContent.com.xml (#12020)
Aug 25, 2017
aa0b7c3
Create sosmedecins-lille.fr.xml (#12039)
Aug 25, 2017
06025aa
Simplify Hitachi_Data_Systems.xml (#12019)
Aug 25, 2017
2fe5e05
Fix: s/httpNowhere/httpNowhereOn
Hainish Aug 25, 2017
e2f93d0
Make fetch test work with .onion domains (#11988)
Aug 25, 2017
61481cb
Remove platform="mixedcontent" rule-skipping attribute, now that we c…
Hainish Aug 25, 2017
63cb8b6
[Eltartar_War] Delete dead ruleset. (#12107)
bardiharborow Aug 26, 2017
7b421a6
[AJs_Ski_and_Sports] Fix ruleset. (#12104)
bardiharborow Aug 26, 2017
eb571d4
Remove 'platform=mixedcontent' from HKGOLDEN.com.xml (#12103)
Aug 26, 2017
08413cd
[Webstaurant_Store] Simplify ruleset. (#12106)
bardiharborow Aug 26, 2017
a48ed7f
[CreativeCommons] Remove some preloaded domains. (#12084)
bardiharborow Aug 26, 2017
cb16d23
[104.com.tw] Update ruleset. (#12102)
bardiharborow Aug 26, 2017
9fc2104
Delete cscportal.org.uk.xml (#11483)
Aug 26, 2017
eba3614
[Color Of Change] Enable ruleset, remove unsupported subdomains (#11565)
galenide Aug 26, 2017
1ba16dd
Update and rename Serverloft.xml to Serverloft.com.xml (#12018)
Aug 26, 2017
1b835c7
re-enable green.ch.xml (#12054)
J0WI Aug 26, 2017
b6c1810
add Fail2ban.org.xml (#12094)
J0WI Aug 26, 2017
5b851fc
Update OpenX.org.xml (#12111)
Aug 26, 2017
8c33594
Update OpenX.com related rulesets (#12110)
Aug 26, 2017
18ebbc6
Update Bigdinosaur.org.xml, Fix #12132 (#12133)
Aug 27, 2017
2146420
Update and rename Locaweb.xml to Locaweb.com.br.xml (#12021)
Aug 27, 2017
7ed24d0
Create arslan.io.xml (#12112)
Aug 27, 2017
6a2bd8e
Create vdvc.de.xml (#12134)
christianheinrichs Aug 27, 2017
7eb858e
Remove shopping.rsbp.org.uk (#7951)
illicitonion Aug 27, 2017
0464d55
Update Qibla.com.xml (#12147)
Aug 27, 2017
39aa815
Add zipcar.co.uk (#8189)
illicitonion Aug 27, 2017
c0b9a23
Update Stallman.org.xml (#12148)
Aug 27, 2017
80e6bdb
Create nytimes2tsqtnxek.onion.xml (#12125)
Bisaloo Aug 27, 2017
70b4423
Create tomritterbassljd.onion.xml (#12143)
Bisaloo Aug 27, 2017
e410667
Create cebix.net.xml (#12144)
christianheinrichs Aug 27, 2017
718f785
Create cloudonaut.io.xml (#12114)
Aug 27, 2017
aedf854
Update HealthCheckUSA.xml (disabled twice) (#12099)
Aug 27, 2017
9346a4b
Create shitcoin.com.xml (#12127)
Aug 27, 2017
c03c0a3
Create SiaHub.info.xml (#12130)
Aug 27, 2017
9176c8b
DuckDuckGo Onion Service (#8748) (#12150)
Aug 27, 2017
7930180
add rule for sony.com.au (fix #11997) (#12053)
J0WI Aug 27, 2017
8c0ba1e
Update Lloydsbank.com.xml (#12121)
Aug 28, 2017
f08a0de
Gone from DNS (Buy-Premium-Tech.xml) (#12168)
Aug 28, 2017
2e10e9f
[Theory.org] Update ruleset. (#12171)
bardiharborow Aug 29, 2017
7727b19
[SearchMarketingNow.com] Update and reactivate ruleset (#10755)
Bisaloo Aug 29, 2017
4f9b98d
Update CONTRIBUTING.md to include the handles of maintainers as well …
Hainish Aug 29, 2017
04b4e1d
Elaborating on instructions to become a ruleset maintainer (closes #9…
Hainish Aug 29, 2017
3e000d6
[OPM.gov] Update and reactivate ruleset
Bisaloo Jul 29, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ charset = utf-8

[src/chrome/content/rules/*.xml]
indent_style = tab
indent_size = 4
indent_size = 4

[*.js]
indent_size = 2
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Welcome, and thank you for your interest in contributing to HTTPS Everywhere! HT

One of the things that makes it easy to contribute to HTTPS Everywhere is that you don't have to be a coder to contribute. That's because HTTPS Everywhere's most important component is the list of rules that tell it when it can request a website over HTTPS. These rules are just XML files that contain regular expressions, so if you can write XML and simple regexes, you can help us add rules and increase HTTPS Everywhere's coverage. No coding skills necessary!

If you want to have the greatest impact, however, you can help be a ruleset maintainer. Ruleset maintainers are volunteers who examine rulesets contributed by others and work with them to ensure that these rulesets work properly and are styled correctly before they're merged in. While we currently have a couple of extremely dedicated and extremely proficient ruleset maintainers, the backlog of sites to add to HTTPS Everywhere just keeps growing, and they need help! If this sounds interesting to you, please contact us at https-everywhere-rules-owner [at] eff <dot> org.
If you want to have the greatest impact, however, you can help be a ruleset maintainer. Ruleset maintainers are trusted volunteers who examine rulesets contributed by others and work with them to ensure that these rulesets work properly and are styled correctly before they're merged in. While we currently have a couple of extremely dedicated and extremely proficient ruleset maintainers, the backlog of sites to add to HTTPS Everywhere just keeps growing, and they need help! If you would like to volunteer to become one, the best thing to do is to build trust in your work by monitoring the repository, contributing pull requests, and commenting on issues that interest you. Then you can contact us at https-everywhere-rules-owner [at] eff <dot> org expressing your interest in helping out.

If you get stuck we have two publicly-archived mailing lists: the https-everywhere list (https://lists.eff.org/mailman/listinfo/https-everywhere) is for discussing the project as a whole, and the https-everywhere-rulesets list (https://lists.eff.org/mailman/listinfo/https-everywhere-rules) is for discussing the `rulesets` and their contents, including patches and git pull requests.

Expand All @@ -19,7 +19,7 @@ There are several main areas of development on HTTPS Everywhere: the rulesets, t

The rulesets can be found in the [`rules`](rules) top-level path and include all the rules for redirecting individual sites to HTTPS. These are written in XML. If you want to get started contributing to HTTPS Everywhere, we recommend starting here.

The core codebase consists of the code that performs the redirects, the UI, logging code, the decentralized SSL observatory code, and ruleset loading, and is written in JavaScript. It is divided into two separate extensions. One is based on the `XPCOM` API used by Mozilla Firefox (soon to be deprecated, located in the [`src`](src) top-level path), and the other is based on the `WebExtensions` API (located in [`chromium`](chromium)), first developed in Google's Chromium browser.
The core codebase consists of the code that performs the redirects, the UI, logging code, and ruleset loading. This encompasses all code delivered with the extension itself that is *not* a ruleset. It is written in JavaScript, using the `WebExtensions` API (located in [`chromium`](chromium)) on all supported browsers. In Firefox, this extension is wrapped in a thin `XPCOM` layer for the purposes of migrating settings, located in [`src`](src), which will soon be deprecated.

The utilities ([`utils`](utils) top-level path) include scripts that build the extension, sanitize and perform normalization on rulesets, simplify rules, and help label GitHub issues. Historically, these utilities have been written in Python. Many of the newer utilities are written in JavaScript, and are meant to be run in node. Some of the wrappers for these utilities are in shell scripts.

Expand Down Expand Up @@ -76,7 +76,7 @@ This would create `Example.com.xml`, which you could then take a look at and edi

## Minimum Requirements for a Ruleset PR

There are several volunteers to HTTPS Everywhere who have graciously dedicated their time to look at the `ruleset` contributions and work with contributors to ensure quality of the pull requests before merging. It is typical for there to be several back-and-fourth communications with these `ruleset` maintainers before a PR is in a good shape to merge. Please be patient and respectful, the maintainers are donating their time for no benefit other than the satisfaction of making the web more secure. They are under no obligation to merge your request, and may reject it if it is impossible to ensure quality.
There are several volunteers to HTTPS Everywhere who have graciously dedicated their time to look at the `ruleset` contributions and work with contributors to ensure quality of the pull requests before merging. It is typical for there to be several back-and-forth communications with these `ruleset` maintainers before a PR is in a good shape to merge. Please be patient and respectful, the maintainers are donating their time for no benefit other than the satisfaction of making the web more secure. They are under no obligation to merge your request, and may reject it if it is impossible to ensure quality. You can identify these volunteers by looking for the "Collaborator" identifier in their comments on HTTPS Everywhere issues and pull requests.

In the back-and-fourth process of getting the `ruleset` in good shape, there may be many commits made. It is this project's convention to squash-and-merge these commits into a single commit before merging into the project. If your commits are cryptographically signed, we may ask you to squash the commits yourself in order to preserve this signature. Otherwise, we may squash them ourselves before merging.

Expand Down Expand Up @@ -314,6 +314,8 @@ Officially supported browsers:

We also informally support Opera browser, but do not have tooling around testing Opera. Firefox ESR is supported because this is what the Tor Browser, which includes HTTPS Everywhere, is built upon. For the test commands, refer to [README.md](README.md).

The current extension maintainer is @Hainish. You can tag him for PRs which involve the core codebase.

Several of our utilities and our full test suite is written in Python. Eventually we would like the whole codebase to be standardized as JavaScript. If you are so inclined, it would be helpful to rewrite the tooling and tests into JavaScript while maintaining the functionality.

* * *
Expand Down
4 changes: 3 additions & 1 deletion chromium/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"node": true,
"webextensions": true
},

"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "script"
},
"rules": {
"indent": [2, 2]
}
}
134 changes: 85 additions & 49 deletions chromium/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,42 @@ var switchPlannerEnabledFor = {};
// rw / nrw stand for "rewritten" versus "not rewritten"
var switchPlannerInfo = {};

// Is HTTPSe enabled, or has it been manually disabled by the user?
/**
* Load preferences. Structure is:
* {
* httpNowhere: Boolean,
* showCounter: Boolean,
* isExtensionEnabled: Boolean
* }
*/
var httpNowhereOn = false;
var showCounter = true;
var isExtensionEnabled = true;
storage.get({globalEnabled: true}, function(item) {
isExtensionEnabled = item.globalEnabled;
updateState();
});

// Load prefs about whether http nowhere is on. Structure is:
// { httpNowhere: true/false }
var httpNowhereOn = false;
storage.get({httpNowhere: false}, function(item) {
storage.get({
httpNowhere: false,
showCounter: true,
globalEnabled: true
}, function(item) {
httpNowhereOn = item.httpNowhere;
showCounter = item.showCounter;
isExtensionEnabled = item.globalEnabled;
updateState();
});

chrome.storage.onChanged.addListener(function(changes, areaName) {
if (areaName === 'sync' || areaName === 'local') {
for (var key in changes) {
if (key === 'httpNowhere') {
httpNowhereOn = changes[key].newValue;
updateState();
} else if (key === 'globalEnabled') {
isExtensionEnabled = changes[key].newValue;
updateState();
}
if ('httpNowhere' in changes) {
httpNowhereOn = changes.httpNowhere.newValue;
updateState();
}
if ('showCounter' in changes) {
showCounter = changes.showCounter.newValue;
updateState();
}
if ('globalEnabled' in changes) {
isExtensionEnabled = changes.globalEnabled.newValue;
updateState();
}
}
});
Expand Down Expand Up @@ -125,6 +136,25 @@ var loadStoredUserRules = function() {

loadStoredUserRules();

function getActiveRulesetCount(id) {
const applied = activeRulesets.getRulesets(id);

if (!applied)
{
return 0;
}

let activeCount = 0;

for (const key in applied) {
if (applied[key].active) {
activeCount++;
}
}

return activeCount;
}

/**
* Set the icon color correctly
* inactive: extension is enabled, but no rules were triggered on this page.
Expand All @@ -136,17 +166,17 @@ var updateState = function() {
if (!chrome.tabs) {
return;
}
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
if (!tabs || tabs.length === 0) {
return;
}
var applied = activeRulesets.getRulesets(tabs[0].id)
var iconState = "inactive";
const activeCount = getActiveRulesetCount(tabs[0].id);
let iconState = "inactive";
if (!isExtensionEnabled) {
iconState = "disabled";
} else if (httpNowhereOn) {
iconState = "blocking";
} else if (applied) {
} else if (activeCount > 0) {
iconState = "active";
}
chrome.browserAction.setIcon({
Expand All @@ -157,6 +187,12 @@ var updateState = function() {
chrome.browserAction.setTitle({
title: "HTTPS Everywhere (" + iconState + ")"
});

chrome.browserAction.setBadgeBackgroundColor({ color: "#00cc00" });

const showBadge = activeCount > 0 && isExtensionEnabled && showCounter;

chrome.browserAction.setBadgeText({ text: showBadge ? String(activeCount) : "" });
});
}

Expand Down Expand Up @@ -280,11 +316,11 @@ function onBeforeRequest(details) {
// analysis process
var using_credentials_in_url = false;
if (uri.password || uri.username) {
using_credentials_in_url = true;
var tmp_user = uri.username;
var tmp_pass = uri.password;
uri.username = null;
uri.password = null;
using_credentials_in_url = true;
var tmp_user = uri.username;
var tmp_pass = uri.password;
uri.username = null;
uri.password = null;
}

var canonical_url = uri.href;
Expand Down Expand Up @@ -332,10 +368,10 @@ function onBeforeRequest(details) {
// HTTP URIs by parent hostname, along with the resource type.
if (switchPlannerEnabledFor[details.tabId] && uri.protocol !== "https:") {
writeToSwitchPlanner(details.type,
details.tabId,
canonical_host,
details.url,
newuristr);
details.tabId,
canonical_host,
details.url,
newuristr);
}

if (httpNowhereOn) {
Expand Down Expand Up @@ -457,28 +493,28 @@ function onCookieChanged(changeInfo) {
if (!changeInfo.removed && !changeInfo.cookie.secure && isExtensionEnabled) {
if (all_rules.shouldSecureCookie(changeInfo.cookie)) {
var cookie = {name:changeInfo.cookie.name,
value:changeInfo.cookie.value,
path:changeInfo.cookie.path,
httpOnly:changeInfo.cookie.httpOnly,
expirationDate:changeInfo.cookie.expirationDate,
storeId:changeInfo.cookie.storeId,
secure: true};
value:changeInfo.cookie.value,
path:changeInfo.cookie.path,
httpOnly:changeInfo.cookie.httpOnly,
expirationDate:changeInfo.cookie.expirationDate,
storeId:changeInfo.cookie.storeId,
secure: true};

// Host-only cookies don't set the domain field.
if (!changeInfo.cookie.hostOnly) {
cookie.domain = changeInfo.cookie.domain;
cookie.domain = changeInfo.cookie.domain;
}

// The cookie API is magical -- we must recreate the URL from the domain and path.
if (changeInfo.cookie.domain[0] == ".") {
cookie.url = "https://www" + changeInfo.cookie.domain + cookie.path;
cookie.url = "https://www" + changeInfo.cookie.domain + cookie.path;
} else {
cookie.url = "https://" + changeInfo.cookie.domain + cookie.path;
cookie.url = "https://" + changeInfo.cookie.domain + cookie.path;
}
// We get repeated events for some cookies because sites change their
// value repeatedly and remove the "secure" flag.
log(DBUG,
"Securing cookie " + cookie.name + " for " + changeInfo.cookie.domain + ", was secure=" + changeInfo.cookie.secure);
"Securing cookie " + cookie.name + " for " + changeInfo.cookie.domain + ", was secure=" + changeInfo.cookie.secure);
chrome.cookies.set(cookie);
}
}
Expand All @@ -489,17 +525,17 @@ function onCookieChanged(changeInfo) {
* @param details details for the redirect (see chrome doc)
* */
function onBeforeRedirect(details) {
// Catch redirect loops (ignoring about:blank, etc. caused by other extensions)
var prefix = details.redirectUrl.substring(0, 5);
if (prefix === "http:" || prefix === "https") {
if (details.requestId in redirectCounter) {
redirectCounter[details.requestId] += 1;
log(DBUG, "Got redirect id "+details.requestId+
// Catch redirect loops (ignoring about:blank, etc. caused by other extensions)
var prefix = details.redirectUrl.substring(0, 5);
if (prefix === "http:" || prefix === "https") {
if (details.requestId in redirectCounter) {
redirectCounter[details.requestId] += 1;
log(DBUG, "Got redirect id "+details.requestId+
": "+redirectCounter[details.requestId]);
} else {
redirectCounter[details.requestId] = 1;
}
} else {
redirectCounter[details.requestId] = 1;
}
}
}

// Registers the handler for requests
Expand Down
8 changes: 4 additions & 4 deletions chromium/devtools-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function e(id) {
*/
function sendMessage(type) {
chrome.runtime.sendMessage({
type: type,
tabId: chrome.devtools.inspectedWindow.tabId,
type: type,
tabId: chrome.devtools.inspectedWindow.tabId,
});
}

Expand Down Expand Up @@ -41,8 +41,8 @@ function disableSwitchPlanner() {
*/
function display() {
chrome.runtime.sendMessage({
type: "getHosts",
tabId: chrome.devtools.inspectedWindow.tabId,
type: "getHosts",
tabId: chrome.devtools.inspectedWindow.tabId,
}, function(response) {
var resources = e("resources");
var switch_planner_details = e("SwitchPlannerDetails");
Expand Down
8 changes: 4 additions & 4 deletions chromium/devtools.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
chrome.devtools.panels.create("HTTPS Everywhere",
"icons/icon-active-38.png",
"devtools-panel.html",
function(panel) {
}
"icons/icon-active-38.png",
"devtools-panel.html",
function(panel) {
}
);
36 changes: 18 additions & 18 deletions chromium/incognito-cache-clearing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ let incognito_session_exists = false;
* @param window: A standard Window object.
*/
function detect_incognito_creation(window) {
if (window.incognito === true) {
incognito_session_exists = true;
}
if (window.incognito === true) {
incognito_session_exists = true;
}
}

/**
* Clear any caches we have.
* Called if an incognito session is destroyed.
*/
function destroy_caches() {
log(DBUG, "Destroying caches.");
all_rules.cookieHostCache.clear();
all_rules.ruleCache.clear();
log(DBUG, "Destroying caches.");
all_rules.cookieHostCache.clear();
all_rules.ruleCache.clear();
}

/**
* Check if any incognito window still exists. If not, destroy caches.
* @param arrayOfWindows: A array of all open Window objects.
*/
function check_for_incognito_session(arrayOfWindows) {
for (let window of arrayOfWindows) {
if (window.incognito === true) {
// An incognito window still exists, so don't destroy caches yet.
return;
}
for (let window of arrayOfWindows) {
if (window.incognito === true) {
// An incognito window still exists, so don't destroy caches yet.
return;
}
// All incognito windows have been closed.
incognito_session_exists = false;
destroy_caches();
}
// All incognito windows have been closed.
incognito_session_exists = false;
destroy_caches();
}

/**
Expand All @@ -47,10 +47,10 @@ function check_for_incognito_session(arrayOfWindows) {
* @param windowId: Ignored.
*/
function detect_incognito_destruction(windowId) {
if (incognito_session_exists) {
// Are any current windows incognito?
chrome.windows.getAll(check_for_incognito_session);
}
if (incognito_session_exists) {
// Are any current windows incognito?
chrome.windows.getAll(check_for_incognito_session);
}
}


Expand Down
Loading