mirror of https://github.com/gorhill/uBlock.git
Fix partyness evaluation for cases of base domain-less hostnames
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/402
This commit is contained in:
parent
f8b6d96ffd
commit
3195f554f7
|
@ -191,8 +191,11 @@
|
||||||
// The idea is to minimize the amout of work done to figure out whether
|
// The idea is to minimize the amout of work done to figure out whether
|
||||||
// the resource is 3rd-party to the document.
|
// the resource is 3rd-party to the document.
|
||||||
is3rdPartyToDoc: function() {
|
is3rdPartyToDoc: function() {
|
||||||
const docDomain = this.getDocDomain();
|
let docDomain = this.getDocDomain();
|
||||||
if ( this.domain !== undefined ) { return this.domain !== docDomain; }
|
if ( docDomain === '' ) { docDomain = this.docHostname; }
|
||||||
|
if ( this.domain !== undefined && this.domain !== '' ) {
|
||||||
|
return this.domain !== docDomain;
|
||||||
|
}
|
||||||
const hostname = this.getHostname();
|
const hostname = this.getHostname();
|
||||||
if ( hostname.endsWith(docDomain) === false ) { return true; }
|
if ( hostname.endsWith(docDomain) === false ) { return true; }
|
||||||
const i = hostname.length - docDomain.length;
|
const i = hostname.length - docDomain.length;
|
||||||
|
@ -248,8 +251,11 @@
|
||||||
// The idea is to minimize the amout of work done to figure out whether
|
// The idea is to minimize the amout of work done to figure out whether
|
||||||
// the resource is 3rd-party to the top document.
|
// the resource is 3rd-party to the top document.
|
||||||
is3rdPartyToTab: function() {
|
is3rdPartyToTab: function() {
|
||||||
const tabDomain = this.getTabDomain();
|
let tabDomain = this.getTabDomain();
|
||||||
if ( this.domain !== undefined ) { return this.domain !== tabDomain; }
|
if ( tabDomain === '' ) { tabDomain = this.tabHostname; }
|
||||||
|
if ( this.domain !== undefined && this.domain !== '' ) {
|
||||||
|
return this.domain !== tabDomain;
|
||||||
|
}
|
||||||
const hostname = this.getHostname();
|
const hostname = this.getHostname();
|
||||||
if ( hostname.endsWith(tabDomain) === false ) { return true; }
|
if ( hostname.endsWith(tabDomain) === false ) { return true; }
|
||||||
const i = hostname.length - tabDomain.length;
|
const i = hostname.length - tabDomain.length;
|
||||||
|
|
|
@ -193,8 +193,6 @@ const LogEntry = function(details) {
|
||||||
this[prop] = details[prop];
|
this[prop] = details[prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Shouldn't this be done in µBlock.filteringContext?
|
|
||||||
// Need to evaluate.
|
|
||||||
if ( this.tabDomain === '' ) {
|
if ( this.tabDomain === '' ) {
|
||||||
this.tabDomain = this.tabHostname || '';
|
this.tabDomain = this.tabHostname || '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue