Skip to content
Snippets Groups Projects
Commit 58799cb5 authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Improve preference screen

parent cd7ca2fa
No related branches found
No related tags found
No related merge requests found
......@@ -82,6 +82,9 @@ var Interceptor = new Class({
}
httpChannel.redirectTo(redirectionURI);
//noinspection JSUnresolvedVariable
require('sdk/simple-prefs').prefs.amountBlocked++;
},
handleMissingCandidate: function (httpChannel) {
......@@ -91,6 +94,9 @@ var Interceptor = new Class({
if (blockMissing) {
httpChannel.cancel(Cr.NS_ERROR_NOT_AVAILABLE);
//noinspection JSUnresolvedVariable
require('sdk/simple-prefs').prefs.amountBlocked++;
}
}
});
......
......@@ -33,6 +33,20 @@ function isValidCandidate(httpChannel) {
return false;
}
//noinspection JSUnresolvedVariable
var whitelistedDomains = require('sdk/simple-prefs').prefs.domainWhitelist.split(";");
for (var domain in whitelistedDomains) {
if (whitelistedDomains[domain] === httpChannel.referrer.host) {
// Remove referer header from request.
httpChannel.setRequestHeader('Referer', null, false);
return false;
}
}
return httpChannel.requestMethod === 'GET';
}
......
......@@ -21,11 +21,25 @@
"title": "Add comments to locally fetched files"
},
{
"description": "Cancel the intercepted request if the required resource is not locally available.",
"description": "Cancel intercepted request if the required resource is not locally available.",
"type": "bool",
"name": "blockMissing",
"value": false,
"title": "Block requests for missing resources"
},
{
"description": "Enter domains to whitelist them. Separate multipe entries with semi-colons (;).",
"type": "string",
"name": "domainWhitelist",
"value": "",
"title": "Exclude domains from inspections"
},
{
"description": "Amount of requests to Content Delivery Networks blocked since installation.",
"type": "integer",
"name": "amountBlocked",
"value": 0,
"title": "Counter for intercepted requests"
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment