mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-13 02:14:17 +01:00
code review: result can be non-blocking yet non-empty
This commit is contained in:
parent
643bb3dcd2
commit
fa3b4c887c
4 changed files with 7 additions and 7 deletions
|
@ -526,7 +526,7 @@ PageStore.prototype.filterRequest = function(context) {
|
||||||
|
|
||||||
// Static filtering never override dynamic filtering
|
// Static filtering never override dynamic filtering
|
||||||
if ( result === '' || result.charAt(1) === 'n' ) {
|
if ( result === '' || result.charAt(1) === 'n' ) {
|
||||||
if ( µb.staticNetFilteringEngine.matchString(context) ) {
|
if ( µb.staticNetFilteringEngine.matchString(context) !== undefined ) {
|
||||||
result = µb.staticNetFilteringEngine.toResultString(µb.logger.isEnabled());
|
result = µb.staticNetFilteringEngine.toResultString(µb.logger.isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ PageStore.prototype.filterRequestNoCache = function(context) {
|
||||||
|
|
||||||
// Static filtering never override dynamic filtering
|
// Static filtering never override dynamic filtering
|
||||||
if ( result === '' || result.charAt(1) === 'n' ) {
|
if ( result === '' || result.charAt(1) === 'n' ) {
|
||||||
if ( µb.staticNetFilteringEngine.matchString(context) ) {
|
if ( µb.staticNetFilteringEngine.matchString(context) !== undefined ) {
|
||||||
result = µb.staticNetFilteringEngine.toResultString(µb.logger.isEnabled());
|
result = µb.staticNetFilteringEngine.toResultString(µb.logger.isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2238,7 +2238,7 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
|
||||||
// Be prepared to support unknown types
|
// Be prepared to support unknown types
|
||||||
var type = typeNameToTypeValue[requestType] || 0;
|
var type = typeNameToTypeValue[requestType] || 0;
|
||||||
if ( type === 0 ) {
|
if ( type === 0 ) {
|
||||||
return false;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
var categories = this.categories;
|
var categories = this.categories;
|
||||||
|
@ -2280,7 +2280,7 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
|
||||||
|
|
||||||
// If there is no block filter, no need to test against allow filters
|
// If there is no block filter, no need to test against allow filters
|
||||||
if ( this.fRegister === null ) {
|
if ( this.fRegister === null ) {
|
||||||
return false;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test against allow filters
|
// Test against allow filters
|
||||||
|
@ -2412,7 +2412,7 @@ FilterContainer.prototype.matchString = function(context) {
|
||||||
|
|
||||||
// If there is no block filter, no need to test against allow filters
|
// If there is no block filter, no need to test against allow filters
|
||||||
if ( this.fRegister === null ) {
|
if ( this.fRegister === null ) {
|
||||||
return false;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test against allow filters
|
// Test against allow filters
|
||||||
|
|
|
@ -507,7 +507,7 @@ vAPI.tabs.onPopup = function(details) {
|
||||||
µb.getNetFilteringSwitch(openerURL) &&
|
µb.getNetFilteringSwitch(openerURL) &&
|
||||||
µb.getNetFilteringSwitch(targetURL)
|
µb.getNetFilteringSwitch(targetURL)
|
||||||
) {
|
) {
|
||||||
if ( µb.staticNetFilteringEngine.matchStringExactType(context, targetURL, 'popup') ) {
|
if ( µb.staticNetFilteringEngine.matchStringExactType(context, targetURL, 'popup') !== undefined ) {
|
||||||
result = µb.staticNetFilteringEngine.toResultString(loggerEnabled);
|
result = µb.staticNetFilteringEngine.toResultString(loggerEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ var onBeforeRootFrameRequest = function(details) {
|
||||||
|
|
||||||
// Filtering
|
// Filtering
|
||||||
if ( result === '' ) {
|
if ( result === '' ) {
|
||||||
if ( µb.staticNetFilteringEngine.matchString(context) ) {
|
if ( µb.staticNetFilteringEngine.matchString(context) !== undefined ) {
|
||||||
// We always need the long-form result here.
|
// We always need the long-form result here.
|
||||||
result = µb.staticNetFilteringEngine.toResultString(true);
|
result = µb.staticNetFilteringEngine.toResultString(true);
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
||||||
|
|
Loading…
Reference in a new issue