Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit abe82ca

Browse files
committed
this fixes #97
1 parent 8ec0359 commit abe82ca

File tree

9 files changed

+68
-18
lines changed

9 files changed

+68
-18
lines changed

css/popup.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ body #scopeKeys {
237237
text-align: right;
238238
}
239239
.matrix .matRow.l2 > .matCell:first-child {
240-
direction: rtl;
240+
/* direction: rtl; */
241241
}
242242
.matrix .matRow > .matCell:hover {
243243
border-style: solid;

info.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ <h2 id="generic-stats">Generic stats</h2>
7878
<li><a href="https://en.wikipedia.org/wiki/HTTP_referer">HTTP referer</a> headers foiled: <span id="refererHeaderFoiledCounter"></span>
7979
<li>Local cookies removed: <span id="cookieRemovedCounter"></span>
8080
<li><a href="http://diveintohtml5.info/storage.html">Local storages</a> emptied: <span id="localStorageRemovedCounter"></span>
81+
<li>Browser caches cleared: <span id="browserCacheClearedCounter"></span>
8182
</ul>
8283
</div>
8384

js/async.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,21 @@ var asyncJobQueue = {
6161

6262
_process: function() {
6363
var now = Date.now();
64-
var keys = Object.keys(this.jobs);
65-
var i = keys.length;
64+
var jobs = this.jobs;
6665
var job;
67-
while ( i-- ) {
68-
job = this.jobs[keys[i]];
66+
for ( var jobName in jobs ) {
67+
if ( !jobs.hasOwnProperty(jobName) ) {
68+
continue;
69+
}
70+
job = jobs[jobName];
6971
if ( job.when > now ) {
7072
continue;
7173
}
7274
job.callback(job.data);
7375
if ( job.period ) {
74-
job.when = Date.now() + job.period;
76+
job.when = now + job.period;
7577
} else {
76-
delete this.jobs[job.name];
78+
delete jobs[jobName];
7779
job._nullify();
7880
this.jobCount--;
7981
this.junkyard.push(job);
@@ -83,12 +85,10 @@ var asyncJobQueue = {
8385
};
8486

8587
function asyncJobQueueHandler() {
86-
if ( asyncJobQueue.jobCount ) {
87-
asyncJobQueue._process();
88-
}
88+
asyncJobQueue._process();
8989
}
9090

91-
setInterval(asyncJobQueueHandler, 100);
91+
setInterval(asyncJobQueueHandler, asyncJobQueue.resolution);
9292

9393
/******************************************************************************/
9494

js/background.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ var HTTPSB = {
3838
popupCollapseDomains: false,
3939
popupCollapseSpecificDomains: {},
4040
maxLoggedRequests: 50,
41-
statsFilters: {
42-
}
41+
statsFilters: {},
42+
clearBrowserCache: false,
43+
clearBrowserCacheAfter: 60
4344
},
4445

4546
runtimeId: 1,
46-
47+
clearBrowserCacheCycle: 0,
4748
inlineFieldSeparator: '#',
4849

4950
// list of remote blacklist locations
@@ -90,11 +91,12 @@ var HTTPSB = {
9091
localStorageRemovedCounter: 0,
9192
cookieHeaderFoiledCounter: 0,
9293
refererHeaderFoiledCounter: 0,
94+
browserCacheClearedCounter: 0,
9395

9496
// internal state
9597
webRequestHandler: false,
9698

97-
// record what chromium is soing behind the scene
99+
// record what chromium is doing behind the scene
98100
behindTheSceneURL: 'http://chromium.behind.the.scene',
99101
behindTheSceneTabId: 0x7FFFFFFF,
100102
behindTheSceneMaxReq: 250,

js/info.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ function renderStats() {
174174
'#localStorageRemovedCounter': httpsb.localStorageRemovedCounter,
175175
'#cookieHeaderFoiledCounter': httpsb.cookieHeaderFoiledCounter,
176176
'#refererHeaderFoiledCounter': httpsb.refererHeaderFoiledCounter,
177+
'#browserCacheClearedCounter': httpsb.browserCacheClearedCounter,
177178
'#blockedAllCount': requestStats.blocked.all,
178179
'#blockedMainFrameCount': blockedStats.main_frame,
179180
'#blockedCookieCount': blockedStats.cookie,

js/settings.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ function initAll() {
182182
$('#delete-unused-session-cookies-after').val(userSettings.deleteUnusedSessionCookiesAfter);
183183
$('#delete-blacklisted-cookies').attr('checked', userSettings.deleteCookies === true);
184184
$('#delete-blacklisted-localstorage').attr('checked', userSettings.deleteLocalStorage);
185+
$('#clear-browser-cache').attr('checked', userSettings.clearBrowserCache === true);
186+
$('#clear-browser-cache-after').val(userSettings.clearBrowserCacheAfter);
185187
$('#process-referer').attr('checked', userSettings.processReferer);
186188
$('#process-behind-the-scene').attr('checked', userSettings.processBehindTheSceneRequests);
187189
$('#max-logged-requests').val(userSettings.maxLoggedRequests);
@@ -211,6 +213,12 @@ function initAll() {
211213
$('#delete-blacklisted-localstorage').on('change', function(){
212214
changeUserSettings('deleteLocalStorage', $(this).is(':checked'));
213215
});
216+
$('#clear-browser-cache').on('change', function(){
217+
changeUserSettings('clearBrowserCache', $(this).is(':checked'));
218+
});
219+
$('#clear-browser-cache-after').on('change', function(){
220+
onChangeValueHandler($(this), 'clearBrowserCacheAfter', 15, 1440);
221+
});
214222
$('#process-referer').on('change', function(){
215223
changeUserSettings('processReferer', $(this).is(':checked'));
216224
});

js/start.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,22 @@ function onDisconnectHandler() {
157157

158158
chrome.extension.onConnect.addListener(onConnectHandler);
159159

160+
/******************************************************************************/
161+
162+
// Browser data jobs
163+
164+
function clearBrowserCacheCallback() {
165+
var httpsb = HTTPSB;
166+
167+
if ( httpsb.userSettings.clearBrowserCache ) {
168+
httpsb.clearBrowserCacheCycle -= 15;
169+
if ( httpsb.clearBrowserCacheCycle <= 0 ) {
170+
httpsb.clearBrowserCacheCycle = httpsb.userSettings.clearBrowserCacheAfter;
171+
httpsb.browserCacheClearedCounter++;
172+
chrome.browsingData.removeCache({ since: 0 });
173+
}
174+
}
175+
}
176+
177+
asyncJobQueue.add('clearBrowserCache', null, clearBrowserCacheCallback, 15 * 60 * 1000, true);
178+

manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "__MSG_extName__",
4-
"version": "0.7.3.1",
4+
"version": "0.7.4.0",
55
"description": "__MSG_extShortDesc__",
66
"icons": {
77
"16": "icon_16.png",
@@ -29,6 +29,7 @@
2929
"default_locale": "en",
3030
"options_page": "settings.html",
3131
"permissions": [
32+
"browsingData",
3233
"contentSettings",
3334
"contextMenus",
3435
"cookies",

settings.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,29 @@ <h2>Privacy</h2>
148148
having to close the browser in order for the session cookies to clear might not
149149
be early enough.</p>
150150
</div>
151-
<li>&nbsp;
152151
<li>
153152
<input id="delete-blacklisted-localstorage" type="checkbox" value="">Delete contents of
154153
<a href="http://en.wikipedia.org/wiki/Web_storage">local storage</a> of blocked hostnames
155-
<li>&nbsp;
154+
<li>
155+
<input id="clear-browser-cache" type="checkbox" value="">Clear browser cache every
156+
<input id="clear-browser-cache-after" type="text" value="60" size="3">minutes.
157+
<button class="whatisthis"></button>
158+
<div class="expandable">
159+
<p>Some web sites are really bent on tracking you, so much that they will use
160+
not-so-nice tricks to work around whatever measures you take in order to not be tracked.</p>
161+
<p>A few of these tricks rely<sup style="font-size:smaller">[1, 2]</sup> on the <a href="https://en.wikipedia.org/wiki/Web_cache">browser cache</a>,
162+
which content is often long lasting since rarely will users take the time to
163+
regularly clear their browser cache.</p>
164+
<p>There is little inconvenience to clear the browser cache regularly
165+
(likelihood is that you won't notice when it happens), and the benefit
166+
is to prevent these obnoxious trackers from invading your privacy.</p>
167+
<p>Check this option to have <i>HTTP Switchboard</i> do it for you, at the interval you
168+
wish.</p>
169+
<p style="font-size:smaller">
170+
[1] <a href="https://grepular.com/Preventing_Web_Tracking_via_the_Browser_Cache">&ldquo;Preventing Web Tracking via the Browser Cache&rdquo;</a><br>
171+
[2] <a href="http://lucb1e.com/rp/cookielesscookies/">&ldquo;Cookieless cookies&rdquo;</a>
172+
</p>
173+
</div>
156174
<li>
157175
<input id="process-referer" type="checkbox" value="">Remove third-party
158176
<a href="https://en.wikipedia.org/wiki/HTTP_referer">HTTP referer</a> information

0 commit comments

Comments
 (0)