mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
code review: page's hostname, not request's hostname
This commit is contained in:
parent
0400352b4f
commit
2a78d7fb99
@ -1752,6 +1752,9 @@ FilterContainer.prototype.dynamicFilterStateToOption = {
|
||||
};
|
||||
|
||||
FilterContainer.prototype.matchDynamicFilters = function(hostname, requestType, firstParty) {
|
||||
if ( typeof hostname !== 'string' || hostname === '' ) {
|
||||
return '';
|
||||
}
|
||||
var party = firstParty ? FirstParty : ThirdParty;
|
||||
if ( typeNameToTypeValue.hasOwnProperty(requestType) === false ) {
|
||||
return '';
|
||||
@ -1948,9 +1951,12 @@ FilterContainer.prototype.matchStringExactType = function(pageDetails, requestUR
|
||||
FirstParty :
|
||||
ThirdParty;
|
||||
|
||||
// This will be used by hostname-based filters
|
||||
pageHostname = pageDetails.pageHostname || '';
|
||||
|
||||
// Evaluate dynamic filters first. "Block" dynamic filters are always
|
||||
// "important", they override everything else.
|
||||
var bf = this.matchDynamicFilters(requestHostname, requestType, party === FirstParty);
|
||||
var bf = this.matchDynamicFilters(pageHostname, requestType, party === FirstParty);
|
||||
if ( bf !== '' && bf.slice(0, 2) !== '@@' ) {
|
||||
return bf;
|
||||
}
|
||||
@ -1959,9 +1965,6 @@ FilterContainer.prototype.matchStringExactType = function(pageDetails, requestUR
|
||||
var categories = this.categories;
|
||||
var buckets = this.buckets;
|
||||
|
||||
// This will be used by hostname-based filters
|
||||
pageHostname = pageDetails.pageHostname || '';
|
||||
|
||||
// Tokenize only once
|
||||
this.tokenize(url);
|
||||
|
||||
@ -2040,16 +2043,16 @@ FilterContainer.prototype.matchString = function(pageDetails, requestURL, reques
|
||||
}
|
||||
}
|
||||
|
||||
// This will be used by hostname-based filters
|
||||
pageHostname = pageDetails.pageHostname || '';
|
||||
|
||||
// Evaluate dynamic filters first. "Block" dynamic filters are always
|
||||
// "important", they override everything else.
|
||||
var bf = this.matchDynamicFilters(requestHostname, requestType, party === FirstParty);
|
||||
var bf = this.matchDynamicFilters(pageHostname, requestType, party === FirstParty);
|
||||
if ( bf !== '' && bf.slice(0, 2) !== '@@' ) {
|
||||
return bf;
|
||||
}
|
||||
|
||||
// This will be used by hostname-based filters
|
||||
pageHostname = pageDetails.pageHostname || '';
|
||||
|
||||
var type = typeNameToTypeValue[requestType];
|
||||
var categories = this.categories;
|
||||
var buckets = this.buckets;
|
||||
|
Loading…
Reference in New Issue
Block a user