mirror of https://github.com/gorhill/uBlock.git
this fixes #689
This commit is contained in:
parent
684dd00e1a
commit
d0f81f5e3b
|
@ -295,12 +295,24 @@ Matrix.prototype.evaluateCellZY = function(srcHostname, desHostname, type) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
Matrix.prototype.mustAllowCellZY = function(srcHostname, desHostname, type) {
|
||||
return this.evaluateCellZY(srcHostname, desHostname, type).r === 2;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
Matrix.prototype.mustBlockOrAllow = function() {
|
||||
return this.r === 1 || this.r === 2;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
Matrix.prototype.mustBlock = function() {
|
||||
return this.r === 1;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
Matrix.prototype.mustAbort = function() {
|
||||
return this.r === 3;
|
||||
};
|
||||
|
@ -325,13 +337,6 @@ Matrix.prototype.toFilterString = function() {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
Matrix.prototype.mustBlock = function(srcHostname, desHostname, type) {
|
||||
this.evaluateCellZY(srcHostname, desHostname, type);
|
||||
return this.r === 1;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
Matrix.prototype.srcHostnameFromRule = function(rule) {
|
||||
return rule.slice(0, rule.indexOf(' '));
|
||||
};
|
||||
|
|
|
@ -333,7 +333,7 @@ var onMessage = function(request, sender, callback) {
|
|||
|
||||
switch ( request.what ) {
|
||||
case 'retrieveDomainCosmeticSelectors':
|
||||
if ( pageStore && pageStore.getNetFilteringSwitch() ) {
|
||||
if ( pageStore && pageStore.getSpecificCosmeticFilteringSwitch() ) {
|
||||
response = µb.cosmeticFilteringEngine.retrieveDomainSelectors(request);
|
||||
}
|
||||
break;
|
||||
|
@ -453,7 +453,7 @@ var onMessage = function(details, sender, callback) {
|
|||
|
||||
switch ( details.what ) {
|
||||
case 'retrieveGenericCosmeticSelectors':
|
||||
if ( pageStore && pageStore.getCosmeticFilteringSwitch() ) {
|
||||
if ( pageStore && pageStore.getGenericCosmeticFilteringSwitch() ) {
|
||||
response = µb.cosmeticFilteringEngine.retrieveGenericSelectors(details);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -601,9 +601,19 @@ PageStore.prototype.getNetFilteringSwitch = function() {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
PageStore.prototype.getCosmeticFilteringSwitch = function() {
|
||||
return this.getNetFilteringSwitch() !== false &&
|
||||
this.skipCosmeticFiltering === false;
|
||||
PageStore.prototype.getSpecificCosmeticFilteringSwitch = function() {
|
||||
return this.getNetFilteringSwitch() &&
|
||||
(µb.userSettings.advancedUserEnabled &&
|
||||
µb.dynamicNetFilteringEngine.mustAllowCellZY(this.rootHostname, this.rootHostname, '*')) === false;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
PageStore.prototype.getGenericCosmeticFilteringSwitch = function() {
|
||||
return this.getNetFilteringSwitch() &&
|
||||
this.skipCosmeticFiltering === false &&
|
||||
(µb.userSettings.advancedUserEnabled &&
|
||||
µb.dynamicNetFilteringEngine.mustAllowCellZY(this.rootHostname, this.rootHostname, '*')) === false;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -638,8 +648,7 @@ PageStore.prototype.filterRequest = function(context) {
|
|||
// We evaluate dynamic filtering first, and hopefully we can skip
|
||||
// evaluation of static filtering.
|
||||
if ( µb.userSettings.advancedUserEnabled ) {
|
||||
var df = µb.dynamicNetFilteringEngine.clearRegisters();
|
||||
df.evaluateCellZY(context.rootHostname, context.requestHostname, context.requestType);
|
||||
var df = µb.dynamicNetFilteringEngine.evaluateCellZY(context.rootHostname, context.requestHostname, context.requestType);
|
||||
if ( df.mustBlockOrAllow() ) {
|
||||
result = df.toFilterString();
|
||||
}
|
||||
|
|
|
@ -154,14 +154,6 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
// For now we will use the net whitelist
|
||||
|
||||
µBlock.getCosmeticFilteringSwitch = function(url) {
|
||||
return this.getNetFilteringSwitch(url);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.stringFromWhitelist = function(whitelist) {
|
||||
var r = {};
|
||||
var i, bucket;
|
||||
|
|
Loading…
Reference in New Issue