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

Commit de8574a

Browse files
committed
preparing for 0.6.2
1 parent 8e99d42 commit de8574a

23 files changed

+897
-302
lines changed

_locales/en/messages.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@
196196
},
197197

198198

199+
"settingsStrictBlockingInfo": {
200+
"message": "<p><strong><a href=\"https://github.com/gorhill/httpswitchboard/wiki/%22Strict-blocking%22-illustrated\">Strict\nblocking</a></strong>,\nintroduced in <a href=\"https://github.com/gorhill/httpswitchboard/wiki/Change-log#036\">version 0.3.6</a>,\nmeans that even\nif you whitelist a specific hostname, blacklisted type of requests (<i>plugins</i>,\n<i>frames</i>, etc.) will remain blacklisted. For some users this maybe\ntoo bothersome, hence this switch.</p>\n<p><strong>Strict blocking on</strong>: blacklisted types of request (if any)\nfor a whitelisted hostname are blocked (unless you explicitly whitelist\nspecifically these types of request for the whitelisted hostname.)</p>\n<p><strong>Strict blocking off</strong>: blacklisted types of request (if any)\nfor a whitelisted hostname are allowed (unless you explicitly blacklist\nspecifically these types of request for the whitelisted hostname.)</p>",
201+
"description": ""
202+
},
203+
204+
199205
"dummy": {
200206
"message": "This entry must be the last one",
201207
"description": "so we dont need to deal with comma for last entry"

_locales/fr/messages.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "extension name."
55
},
66
"extShortDesc": {
7-
"message": "Simplement un clic pour interdire ou permettre n'importe quel types de requête faites par votre fureteur. Bloquez les scripts, iframes, pubs, facebook, etc.",
7+
"message": "Un simple clic pour interdire ou permettre n'importe quel types de requête faites par votre fureteur. Bloquez les scripts, iframes, pubs, facebook, etc.",
88
"description": "this will in chrome web store"
99
},
1010
"ruleManagerPageName": {
@@ -196,6 +196,12 @@
196196
},
197197

198198

199+
"settingsStrictBlockingInfo": {
200+
"message": "<strong><a href=\"https://github.com/gorhill/httpswitchboard/wiki/%22Strict-blocking%22-illustrated\">Blocage strict</a></strong>, introduit dans la <a href=\"https://github.com/gorhill/httpswitchboard/wiki/Change-log#036\">version 0.3.6</a>, signifie que même si vous allouez un nom d'hôte spécifique, une requête restera bloquée si le type d'objet à requérir (plugins, iframes, etc) est lui-même bloqué. Pour certains utilisateurs, ce peut-être trop restrictif, d'où la possibilité de choisir la logique de blocage ici.\n<strong>Blocage strict</strong>: pour qu'une requête ne soit pas bloquée, le nom d'hôte ET le type de requête doivent être alloués.\n</strong>Blocage non strict</strong>: pour qu'une requête ne soit pas bloquée, seul le nom d'hôte doir être alloué.",
201+
"description": ""
202+
},
203+
204+
199205
"dummy": {
200206
"message": "This entry must be the last one",
201207
"description": "so we dont need to deal with comma for last entry"

assets/httpsb-blacklist.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ adgear.com # "AdGear is an online advertising technologies company base
77
adnxs.com # "Adnxs.com is run by AppNexus, a company that provides technology, data and analytics to help companies buy and sell online display advertising" (Ref.: http://www.theguardian.com/technology/2012/apr/23/adnxs-tracking-trackers-cookies-web-monitoring)
88
adobetag.com # "Adobe Announces Adobe Tag Manager for the Online Marketing Suite"
99
aimatch.com # "Ad Server, SAS® Intelligent Advertising for Publishers"
10+
analytics.edgesuite.net
1011
atedra.com # "Atedra est un réseau de publicité Internet francophone au Canada"
1112
axf8.net # https://www.eff.org/deeplinks/2013/06/third-party-resources-nsa-leaks
1213
betrad.com # "Evidon: Home | Online Marketing Intelligence, Web Analytics, Privacy" (which also publishes "Ghostery" add-on..)
@@ -24,6 +25,8 @@ crsspxl.com # Related to crosspixel.net
2425
displaymarketplace.com
2526
erovinmo.com # No info whatsoever from site itself can be found = naughty corner. Ironically spotted at "http://www.technologyreview.com/news/519336/bruce-schneier-nsa-spying-is-making-us-less-safe/" (also: http://www.mywot.com/en/scorecard/erovinmo.com)
2627
exelator.com # "domain used by eXelate Media which is an advertising company that is part of a network of sites, cookies, and other technologies used to track you" (Ref.: http://www.donottrackplus.com/trackers/exelator.com.php)
28+
everestjs.net # related to `everesttech.net`
29+
everesttech.net # "search engine marketing (SEM) solutions", pixel image on the page, looks like tracking to me. Spotted @ `http://www.homedepot.ca/` (search worked fine when blocking this hostname)
2730
eyereturn.com # "eyeReturn Marketing is the only end-to-end digital advertising platform in the market"
2831
gigya.com # "The tools you need to connect with consumers, harness rich data, and make marketing relevant"
2932
krxd.net # https://www.eff.org/deeplinks/2013/06/third-party-resources-nsa-leaks

background.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<script src="lib/publicsuffixlist.min.js"></script>
99

1010
<script src="js/types.js"></script>
11+
<script src="js/strpacker.js"></script>
1112
<script src="js/uritools.js"></script>
13+
<script src="js/usersettings.js"></script>
1214
<script src="js/async.js"></script>
1315
<script src="js/lists.js"></script>
1416
<script src="js/background.js"></script>

info.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h2 data-i18n="statsPageWhitelistsBlacklists"></h2>
9494
</div>
9595

9696

97-
<h2 data-i18n="statsPageGeekyStats"></h2>
97+
<h2 data-i18n="statsPageGeekyStats" id="geeky-stats"></h2>
9898
<div>For
9999
<select id="selectPageUrls">
100100
<option value="All">All</option>
@@ -148,6 +148,7 @@ <h3 data-i18n="statsPageOverview"></h3>
148148

149149
<h3 data-i18n="statsPageDetailed"></h3>
150150
<div id="requests">
151+
<p style="font-size:small">You can change the maximum number of most recent HTTP requests to log (currently set at <span id="maxLoggedRequests"></span> per page) on the <a href="settings.html">Settings</a> page.</p>
151152
<p><button id="refresh-requests" data-i18n="statsPageRefresh"></button></p>
152153
<p>
153154
Show: <input id="show-main_frame" type="checkbox" checked value="1">Pages&emsp;

js/async.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,7 @@ function onMessageHandler(request, sender, callback) {
188188

189189
case 'userSettings':
190190
if ( typeof request.name === 'string' && request.name !== '' ) {
191-
if ( HTTPSB.userSettings[request.name] !== undefined && request.value !== undefined ) {
192-
HTTPSB.userSettings[request.name] = request.value;
193-
}
194-
response = HTTPSB.userSettings[request.name];
195-
saveUserSettings();
191+
response = changeUserSettings(request.name, request.value);
196192
}
197193
break;
198194

@@ -212,7 +208,7 @@ function onMessageHandler(request, sender, callback) {
212208
}
213209
}
214210

215-
if ( callback ) {
211+
if ( response && callback ) {
216212
callback(response);
217213
}
218214
}

js/background.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ var HTTPSB = {
3232
displayTextSize: '13px',
3333
popupHideBlacklisted: false,
3434
popupCollapseDomains: false,
35-
popupCollapseSpecificDomains: {}
35+
popupCollapseSpecificDomains: {},
36+
maxLoggedRequests: 250,
37+
statsFilters: {
38+
}
3639
},
3740

3841
runtimeId: 1,
@@ -60,16 +63,19 @@ var HTTPSB = {
6063

6164
// tabs are used to redirect stats collection to a specific url stats
6265
// structure.
63-
pageUrlToTabId: { },
64-
tabIdToPageUrl: { },
66+
pageUrlToTabId: {},
67+
tabIdToPageUrl: {},
68+
69+
// Power switch to disengage HTTPSB
70+
off: false,
6571

6672
// page url => permission scope
6773
temporaryScopes: null,
6874
permanentScopes: null,
6975

7076
// Current entries from remote blacklists --
7177
// just hostnames, '*/' is implied, this saves significantly on memory.
72-
blacklistReadonly: { },
78+
blacklistReadonly: {},
7379

7480
// https://github.com/gorhill/httpswitchboard/issues/19
7581
excludeRegex: /^https?:\/\/chrome\.google\.com\/(extensions|webstore)/,

js/cookies.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ var cookieHunter = {
3434
// rhill 2013-10-19: pageStats could be nil, for example, this can
3535
// happens if a file:// ... makes an xmlHttpRequest
3636
if ( pageStats ) {
37-
this.queuePageRecord[pageUrlFromPageStats(pageStats)] = pageStats;
37+
var pageURL = pageUrlFromPageStats(pageStats);
38+
cookieHunter.queuePageRecord[pageURL] = pageStats;
3839
asyncJobQueue.add(
3940
'cookieHunterPageRecord',
4041
null,
4142
function() { cookieHunter.processPageRecord(); },
42-
500,
43+
1000,
4344
false);
4445
}
4546
},
@@ -51,7 +52,8 @@ var cookieHunter = {
5152
// rhill 2013-10-19: pageStats could be nil, for example, this can
5253
// happens if a file:// ... makes an xmlHttpRequest
5354
if ( pageStats ) {
54-
this.queuePageRemove[pageUrlFromPageStats(pageStats)] = pageStats;
55+
var pageURL = pageUrlFromPageStats(pageStats);
56+
cookieHunter.queuePageRemove[pageURL] = pageStats;
5557
asyncJobQueue.add(
5658
'cookieHunterPageRemove',
5759
null,
@@ -63,40 +65,38 @@ var cookieHunter = {
6365

6466
// Candidate for removal
6567
remove: function(cookie) {
66-
this.queueRemove[cookie.url + '|' + cookie.name] = cookie;
68+
cookieHunter.queueRemove[cookie.url + '|' + cookie.name] = cookie;
6769
},
6870

6971
processPageRecord: function() {
7072
// record cookies from a specific page
71-
var pageUrls = Object.keys(this.queuePageRecord);
73+
var pageUrls = Object.keys(cookieHunter.queuePageRecord);
7274
var i = pageUrls.length;
7375
while ( i-- ) {
74-
this._processPageRecord(pageUrls[i]);
76+
cookieHunter._processPageRecord(pageUrls[i]);
7577
}
7678
},
7779

7880
_processPageRecord: function(pageUrl) {
79-
var me = this;
8081
chrome.cookies.getAll({}, function(cookies) {
81-
me._hunt(me.queuePageRecord[pageUrl], cookies, true);
82-
delete me.queuePageRecord[pageUrl];
82+
cookieHunter._hunt(cookieHunter.queuePageRecord[pageUrl], cookies, true);
83+
delete cookieHunter.queuePageRecord[pageUrl];
8384
});
8485
},
8586

8687
processPageRemove: function() {
8788
// erase cookies from a specific page
88-
var pageUrls = Object.keys(this.queuePageRemove);
89+
var pageUrls = Object.keys(cookieHunter.queuePageRemove);
8990
var i = pageUrls.length;
9091
while ( i-- ) {
91-
this._processPageRemove(pageUrls[i]);
92+
cookieHunter._processPageRemove(pageUrls[i]);
9293
}
9394
},
9495

9596
_processPageRemove: function(pageUrl) {
96-
var me = this;
9797
chrome.cookies.getAll({}, function(cookies) {
98-
me._hunt(me.queuePageRemove[pageUrl], cookies, false);
99-
delete me.queuePageRemove[pageUrl];
98+
cookieHunter._hunt(cookieHunter.queuePageRemove[pageUrl], cookies, false);
99+
delete cookieHunter.queuePageRemove[pageUrl];
100100
});
101101
},
102102

@@ -108,7 +108,6 @@ var cookieHunter = {
108108
if ( !httpsb.userSettings.deleteCookies ) {
109109
return;
110110
}
111-
var me = this;
112111
chrome.cookies.getAll({}, function(cookies) {
113112
// quickProfiler.start();
114113
var i = cookies.length;
@@ -121,7 +120,7 @@ var cookieHunter = {
121120
cookieUrl = (cookie.secure ? 'https://' : 'http://') + domain + cookie.path;
122121
// be mindful of https://github.com/gorhill/httpswitchboard/issues/19
123122
if ( !httpsb.excludeRegex.test(cookieUrl) ) {
124-
me.remove({
123+
cookieHunter.remove({
125124
url: cookieUrl,
126125
domain: cookie.domain,
127126
name: cookie.name
@@ -139,22 +138,22 @@ var cookieHunter = {
139138
// Remove only some of the cookies which are candidate for removal:
140139
// who knows, maybe a user has 1000s of cookies sitting in his
141140
// browser...
142-
var cookieKeys = Object.keys(this.queueRemove);
141+
var cookieKeys = Object.keys(cookieHunter.queueRemove);
143142
if ( cookieKeys.length > 50 ) {
144143
cookieKeys = cookieKeys.sort(function(){return Math.random() < Math.random();}).splice(0, 50);
145144
}
146145
var cookieKey, cookie;
147146
while ( cookieKey = cookieKeys.pop() ) {
148-
cookie = this.queueRemove[cookieKey];
149-
delete this.queueRemove[cookieKey];
147+
cookie = cookieHunter.queueRemove[cookieKey];
148+
delete cookieHunter.queueRemove[cookieKey];
150149
// Just in case setting was changed after cookie was put in queue.
151150
if ( !httpsb.userSettings.deleteCookies ) {
152151
continue;
153152
}
154153
// Ensure cookie is not allowed on ALL current web pages: It can
155154
// happen that a cookie is blacklisted on one web page while
156155
// being whitelisted on another (because of per-page permissions).
157-
if ( this._dontRemoveCookie(cookie) ) {
156+
if ( cookieHunter._dontRemoveCookie(cookie) ) {
158157
// console.debug('HTTP Switchboard > cookieHunter.processRemove(): Will NOT remove cookie %s/{%s}', cookie.url, cookie.name);
159158
continue;
160159
}
@@ -204,7 +203,7 @@ var cookieHunter = {
204203
// Leave alone cookies from behind-the-scene requests if
205204
// behind-the-scene processing is disabled.
206205
if ( block && deleteCookies && (pageUrl !== httpsb.behindTheSceneURL || httpsb.userSettings.processBehindTheSceneRequests) ) {
207-
this.remove({
206+
cookieHunter.remove({
208207
url: rootUrl + cookie.path,
209208
domain: cookie.domain,
210209
name: cookie.name

js/httpsb.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ HTTPSB.scopePageExists = function(url) {
131131
/******************************************************************************/
132132

133133
HTTPSB.evaluate = function(src, type, hostname) {
134+
if ( this.off ) {
135+
return 'gpt';
136+
}
134137
return this.temporaryScopes.evaluate(src, type, hostname);
135138
};
136139

js/info.js

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ function requestDetails(url, type, when, blocked) {
5252
function updateRequestData() {
5353
var requests = [];
5454
var pageUrls = targetUrl === 'All' ?
55-
Object.keys(gethttpsb().pageStats) :
56-
[targetUrl];
55+
Object.keys(gethttpsb().pageStats) :
56+
[targetUrl];
5757
var iPageUrl, nPageUrls, pageUrl;
5858
var reqKeys, iReqKey, nReqKeys, reqKey;
5959
var pageStats, pageRequests;
60-
var i, entry;
60+
var pos, reqURL, reqType, entry;
6161

6262
nPageUrls = pageUrls.length;
6363
for ( iPageUrl = 0; iPageUrl < nPageUrls; iPageUrl++ ) {
@@ -68,18 +68,24 @@ function updateRequestData() {
6868
continue;
6969
}
7070
pageRequests = pageStats.requests;
71-
reqKeys = Object.keys(pageRequests);
71+
reqKeys = pageRequests.getLoggedRequests();
7272
nReqKeys = reqKeys.length;
7373
for ( iReqKey = 0; iReqKey < nReqKeys; iReqKey++ ) {
7474
reqKey = reqKeys[iReqKey];
75-
entry = pageRequests[reqKey];
76-
i = reqKey.indexOf('#');
77-
// Using parseFloat because of
78-
// http://jsperf.com/performance-of-parseint
75+
if ( !reqKey ) {
76+
continue;
77+
}
78+
pos = reqKey.indexOf('#');
79+
reqURL = reqKey.slice(0, pos);
80+
reqType = reqKey.slice(pos + 1);
81+
entry = pageRequests.getLoggedRequestEntry(reqURL, reqType);
82+
if ( !entry ) {
83+
continue;
84+
}
7985
requests.push(new requestDetails(
80-
reqKey.slice(0, i),
86+
reqURL,
8187
entry.when,
82-
reqKey.slice(i+1),
88+
reqType,
8389
entry.blocked
8490
));
8591
}
@@ -205,7 +211,8 @@ function renderStats() {
205211
'#allowedScriptCount': allowedStats.script,
206212
'#allowedXHRCount': allowedStats.xmlhttprequest,
207213
'#allowedSubFrameCount': allowedStats.sub_frame,
208-
'#allowedOtherCount': allowedStats.other
214+
'#allowedOtherCount': allowedStats.other,
215+
'#maxLoggedRequests': httpsb.userSettings.maxLoggedRequests
209216
});
210217
}
211218

@@ -240,7 +247,7 @@ function renderRequestRow(row, request) {
240247
$(cells[3]).text(request.url);
241248
}
242249

243-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
250+
/*----------------------------------------------------------------------------*/
244251

245252
function renderRequests() {
246253
var table = $('#requestsTable tbody');
@@ -275,6 +282,27 @@ function renderRequests() {
275282

276283
/******************************************************************************/
277284

285+
function changeFilterHandler() {
286+
// Save new state of filters in user settings
287+
// Initialize request filters as per user settings:
288+
// https://github.com/gorhill/httpswitchboard/issues/49
289+
var statsFilters = gethttpsb().userSettings.statsFilters;
290+
$('input[id^="show-"][type="checkbox"]').each(function() {
291+
var input = $(this);
292+
statsFilters[input.attr('id')] = !!input.prop('checked');
293+
});
294+
295+
chrome.runtime.sendMessage({
296+
what: 'userSettings',
297+
name: 'statsFilters',
298+
value: statsFilters
299+
});
300+
301+
syncWithFilters();
302+
}
303+
304+
/******************************************************************************/
305+
278306
// Synchronize list of net requests with filter states
279307

280308
function syncWithFilters() {
@@ -322,9 +350,18 @@ function initAll() {
322350
$('#version').html(gethttpsb().manifest.version);
323351
$('a:not([target])').prop('target', '_blank');
324352

353+
// Initialize request filters as per user settings:
354+
// https://github.com/gorhill/httpswitchboard/issues/49
355+
$('input[id^="show-"][type="checkbox"]').each(function() {
356+
var statsFilters = gethttpsb().userSettings.statsFilters;
357+
var input = $(this);
358+
var filter = statsFilters[input.attr('id')];
359+
input.prop('checked', filter === undefined || filter === true);
360+
});
361+
325362
// Event handlers
326363
$('#refresh-requests').on('click', renderRequests);
327-
$('input[id^="show-"][type="checkbox"]').on('change', syncWithFilters);
364+
$('input[id^="show-"][type="checkbox"]').on('change', changeFilterHandler);
328365
$('#selectPageUrls').on('change', targetUrlChangeHandler);
329366

330367
renderTransientData(true);

0 commit comments

Comments
 (0)