mirror of https://github.com/gorhill/uBlock.git
fix #2763
This commit is contained in:
parent
1836f7656e
commit
51a4e9ccf4
|
@ -1363,7 +1363,7 @@ var reverseLookupManager = (function() {
|
||||||
'loggerUI',
|
'loggerUI',
|
||||||
{
|
{
|
||||||
what: 'listsFromCosmeticFilter',
|
what: 'listsFromCosmeticFilter',
|
||||||
hostname: row.getAttribute('data-hn-frame') || '',
|
url: row.cells[5].textContent,
|
||||||
rawFilter: rawFilter,
|
rawFilter: rawFilter,
|
||||||
},
|
},
|
||||||
reverseLookupDone
|
reverseLookupDone
|
||||||
|
|
|
@ -69,11 +69,7 @@ var onMessage = function(request, sender, callback) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'listsFromCosmeticFilter':
|
case 'listsFromCosmeticFilter':
|
||||||
µb.staticFilteringReverseLookup.fromCosmeticFilter(
|
µb.staticFilteringReverseLookup.fromCosmeticFilter(request, callback);
|
||||||
request.hostname,
|
|
||||||
request.rawFilter,
|
|
||||||
callback
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'reloadAllFilters':
|
case 'reloadAllFilters':
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
uBlock Origin - a browser extension to block requests.
|
||||||
Copyright (C) 2014-2018 Raymond Hill
|
Copyright (C) 2014-present Raymond Hill
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -319,10 +319,8 @@ PageStore.prototype.init = function(tabId, context) {
|
||||||
// Support `generichide` filter option.
|
// Support `generichide` filter option.
|
||||||
this.noGenericCosmeticFiltering = this.noCosmeticFiltering;
|
this.noGenericCosmeticFiltering = this.noCosmeticFiltering;
|
||||||
if ( this.noGenericCosmeticFiltering !== true ) {
|
if ( this.noGenericCosmeticFiltering !== true ) {
|
||||||
var result = µb.staticNetFilteringEngine.matchStringExactType(
|
let result = µb.staticNetFilteringEngine.matchStringGenericHide(
|
||||||
this.createContextFromPage(),
|
tabContext.normalURL
|
||||||
tabContext.normalURL,
|
|
||||||
'generichide'
|
|
||||||
);
|
);
|
||||||
this.noGenericCosmeticFiltering = result === 2;
|
this.noGenericCosmeticFiltering = result === 2;
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -172,6 +172,12 @@ var fromCosmeticFilter = function(details) {
|
||||||
if ( end === -1 ) { end = content.length; }
|
if ( end === -1 ) { end = content.length; }
|
||||||
pos = end;
|
pos = end;
|
||||||
fargs = JSON.parse(content.slice(beg, end));
|
fargs = JSON.parse(content.slice(beg, end));
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/2763
|
||||||
|
if ( fargs[0] >= 0 && fargs[0] <= 5 && details.ignoreGeneric ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch ( fargs[0] ) {
|
switch ( fargs[0] ) {
|
||||||
case 0: // id-based
|
case 0: // id-based
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -161,12 +161,10 @@ var fromNetFilter = function(compiledFilter, rawFilter, callback) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var fromCosmeticFilter = function(hostname, rawFilter, callback) {
|
var fromCosmeticFilter = function(details, callback) {
|
||||||
if ( typeof callback !== 'function' ) {
|
if ( typeof callback !== 'function' ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( rawFilter === '' ) {
|
if ( details.rawFilter === '' ) {
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -176,17 +174,19 @@ var fromCosmeticFilter = function(hostname, rawFilter, callback) {
|
||||||
workerTTLTimer = null;
|
workerTTLTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var onWorkerReady = function() {
|
let onWorkerReady = function() {
|
||||||
var id = messageId++;
|
let id = messageId++;
|
||||||
var message = {
|
let hostname = µBlock.URI.hostnameFromURI(details.url);
|
||||||
|
pendingResponses[id] = callback;
|
||||||
|
worker.postMessage({
|
||||||
what: 'fromCosmeticFilter',
|
what: 'fromCosmeticFilter',
|
||||||
id: id,
|
id: id,
|
||||||
domain: µBlock.URI.domainFromHostname(hostname),
|
domain: µBlock.URI.domainFromHostname(hostname),
|
||||||
hostname: hostname,
|
hostname: hostname,
|
||||||
rawFilter: rawFilter
|
ignoreGeneric: µBlock.staticNetFilteringEngine
|
||||||
};
|
.matchStringGenericHide(details.url) === 2,
|
||||||
pendingResponses[id] = callback;
|
rawFilter: details.rawFilter
|
||||||
worker.postMessage(message);
|
});
|
||||||
|
|
||||||
// The worker will be shutdown after n minutes without being used.
|
// The worker will be shutdown after n minutes without being used.
|
||||||
workerTTLTimer = vAPI.setTimeout(stopWorker, workerTTL);
|
workerTTLTimer = vAPI.setTimeout(stopWorker, workerTTL);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
uBlock Origin - a browser extension to block requests.
|
||||||
Copyright (C) 2014-2018 Raymond Hill
|
Copyright (C) 2014-present Raymond Hill
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2525,14 +2525,14 @@ FilterContainer.prototype.matchTokens = function(bucket, url) {
|
||||||
// https://github.com/gorhill/uBlock/issues/2103
|
// https://github.com/gorhill/uBlock/issues/2103
|
||||||
// User may want to override `generichide` exception filters.
|
// User may want to override `generichide` exception filters.
|
||||||
|
|
||||||
FilterContainer.prototype.matchStringGenericHide = function(context, requestURL) {
|
FilterContainer.prototype.matchStringGenericHide = function(requestURL) {
|
||||||
var url = this.urlTokenizer.setURL(requestURL);
|
let url = this.urlTokenizer.setURL(requestURL);
|
||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/2225
|
// https://github.com/gorhill/uBlock/issues/2225
|
||||||
// Important: this is used by FilterHostnameDict.match().
|
// Important: this is used by FilterHostnameDict.match().
|
||||||
requestHostnameRegister = µb.URI.hostnameFromURI(url);
|
requestHostnameRegister = µb.URI.hostnameFromURI(url);
|
||||||
|
|
||||||
var bucket = this.categories.get(genericHideException);
|
let bucket = this.categories.get(genericHideException);
|
||||||
if ( !bucket || this.matchTokens(bucket, url) === false ) {
|
if ( !bucket || this.matchTokens(bucket, url) === false ) {
|
||||||
this.fRegister = null;
|
this.fRegister = null;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2557,7 +2557,7 @@ FilterContainer.prototype.matchStringGenericHide = function(context, requestURL)
|
||||||
FilterContainer.prototype.matchStringExactType = function(context, requestURL, requestType) {
|
FilterContainer.prototype.matchStringExactType = function(context, requestURL, requestType) {
|
||||||
// Special cases.
|
// Special cases.
|
||||||
if ( requestType === 'generichide' ) {
|
if ( requestType === 'generichide' ) {
|
||||||
return this.matchStringGenericHide(context, requestURL);
|
return this.matchStringGenericHide(requestURL);
|
||||||
}
|
}
|
||||||
var type = typeNameToTypeValue[requestType];
|
var type = typeNameToTypeValue[requestType];
|
||||||
if ( type === undefined ) {
|
if ( type === undefined ) {
|
||||||
|
|
Loading…
Reference in New Issue