mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
Fix highligthing of FQDN match in logger
Related feedback: - https://github.com/uBlockOrigin/uAssets/issues/7619#issuecomment-653010310 Also fixed strict-blocking of URL using FQDN.
This commit is contained in:
parent
324b4fe9c1
commit
941898e54e
@ -923,7 +923,7 @@ const FilterAnchorHn = class extends FilterAnchorHnLeft {
|
|||||||
logData(details) {
|
logData(details) {
|
||||||
super.logData(details);
|
super.logData(details);
|
||||||
details.pattern.push('^');
|
details.pattern.push('^');
|
||||||
details.regex.push(restrSeparator);
|
details.regex.push('\\.?', restrSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
toSelfie() {
|
toSelfie() {
|
||||||
@ -1709,7 +1709,7 @@ const FilterHostnameDict = class {
|
|||||||
|
|
||||||
logData(details) {
|
logData(details) {
|
||||||
details.pattern.push('||', this.$h, '^');
|
details.pattern.push('||', this.$h, '^');
|
||||||
details.regex.push(restrFromPlainPattern(this.$h), restrSeparator);
|
details.regex.push(restrFromPlainPattern(this.$h), '\\.?', restrSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
toSelfie() {
|
toSelfie() {
|
||||||
|
@ -254,9 +254,13 @@ const toBlockDocResult = function(url, hostname, logData) {
|
|||||||
// https://github.com/chrisaljoudi/uBlock/issues/1212
|
// https://github.com/chrisaljoudi/uBlock/issues/1212
|
||||||
// Verify that the end of the match is anchored to the end of the
|
// Verify that the end of the match is anchored to the end of the
|
||||||
// hostname.
|
// hostname.
|
||||||
const end = match.index + match[0].length -
|
// https://github.com/uBlockOrigin/uAssets/issues/7619#issuecomment-653010310
|
||||||
url.indexOf(hostname) - hostname.length;
|
// Also match FQDN.
|
||||||
return end === 0 || end === 1;
|
const hnpos = url.indexOf(hostname);
|
||||||
|
const hnlen = hostname.length;
|
||||||
|
const end = match.index + match[0].length - hnpos - hnlen;
|
||||||
|
return end === 0 || end === 1 ||
|
||||||
|
end === 2 && url.charCodeAt(hnpos + hnlen) === 0x2E /* '.' */;
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user