mirror of
https://github.com/ClearURLs/Addon.git
synced 2024-10-03 22:58:10 +03:00
Merge branch 'test-mr-93'
This commit is contained in:
commit
9c61d9d77a
32
clearurls.js
32
clearurls.js
@ -216,6 +216,12 @@ function start() {
|
||||
for (let re = 0; re < redirections.length; re++) {
|
||||
providers[p].addRedirection(redirections[re]);
|
||||
}
|
||||
|
||||
let methods = data.providers[prvKeys[p]].getOrDefault('methods', []);
|
||||
//Add HTTP methods list to provider
|
||||
for (let re = 0; re < methods.length; re++) {
|
||||
providers[p].addMethod(methods[re]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,6 +350,7 @@ function start() {
|
||||
let disabled_rawRules = {};
|
||||
let enabled_referralMarketing = {};
|
||||
let disabled_referralMarketing = {};
|
||||
let methods = [];
|
||||
|
||||
if (_completeProvider) {
|
||||
enabled_rules[".*"] = true;
|
||||
@ -496,6 +503,28 @@ function start() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a HTTP method to methods list.
|
||||
*
|
||||
* @param {String} method HTTP Method Name
|
||||
*/
|
||||
this.addMethod = function (method) {
|
||||
if (methods.indexOf(method) === -1) {
|
||||
methods.push(method);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the requests' method.
|
||||
*
|
||||
* @param {requestDetails} details Requests details
|
||||
* @returns {boolean} should be filtered or not
|
||||
*/
|
||||
this.matchMethod = function (details) {
|
||||
if (!methods.length) return true;
|
||||
return methods.indexOf(details['method']) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private helper method to check if the url
|
||||
* an exception.
|
||||
@ -570,7 +599,7 @@ function start() {
|
||||
* Function which called from the webRequest to
|
||||
* remove the tracking fields from the url.
|
||||
*
|
||||
* @param {webRequest} request webRequest-Object
|
||||
* @param {requestDetails} request webRequest-Object
|
||||
* @return {Array} redirectUrl or none
|
||||
*/
|
||||
function clearUrl(request) {
|
||||
@ -598,6 +627,7 @@ function start() {
|
||||
* Call for every provider the removeFieldsFormURL method.
|
||||
*/
|
||||
for (let i = 0; i < providers.length; i++) {
|
||||
if (!providers[i].matchMethod(request)) continue;
|
||||
if (providers[i].matchURL(request.url)) {
|
||||
result = removeFieldsFormURL(providers[i], request.url, false, request);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user