mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
code review: result can be non-blocking yet non-empty
This commit is contained in:
parent
643bb3dcd2
commit
fa3b4c887c
@ -526,7 +526,7 @@ PageStore.prototype.filterRequest = function(context) {
|
||||
|
||||
// Static filtering never override dynamic filtering
|
||||
if ( result === '' || result.charAt(1) === 'n' ) {
|
||||
if ( µb.staticNetFilteringEngine.matchString(context) ) {
|
||||
if ( µb.staticNetFilteringEngine.matchString(context) !== undefined ) {
|
||||
result = µb.staticNetFilteringEngine.toResultString(µb.logger.isEnabled());
|
||||
}
|
||||
}
|
||||
@ -568,7 +568,7 @@ PageStore.prototype.filterRequestNoCache = function(context) {
|
||||
|
||||
// Static filtering never override dynamic filtering
|
||||
if ( result === '' || result.charAt(1) === 'n' ) {
|
||||
if ( µb.staticNetFilteringEngine.matchString(context) ) {
|
||||
if ( µb.staticNetFilteringEngine.matchString(context) !== undefined ) {
|
||||
result = µb.staticNetFilteringEngine.toResultString(µb.logger.isEnabled());
|
||||
}
|
||||
}
|
||||
|
@ -2238,7 +2238,7 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
|
||||
// Be prepared to support unknown types
|
||||
var type = typeNameToTypeValue[requestType] || 0;
|
||||
if ( type === 0 ) {
|
||||
return false;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
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 ( this.fRegister === null ) {
|
||||
return false;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// 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 ( this.fRegister === null ) {
|
||||
return false;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Test against allow filters
|
||||
|
@ -507,7 +507,7 @@ vAPI.tabs.onPopup = function(details) {
|
||||
µb.getNetFilteringSwitch(openerURL) &&
|
||||
µb.getNetFilteringSwitch(targetURL)
|
||||
) {
|
||||
if ( µb.staticNetFilteringEngine.matchStringExactType(context, targetURL, 'popup') ) {
|
||||
if ( µb.staticNetFilteringEngine.matchStringExactType(context, targetURL, 'popup') !== undefined ) {
|
||||
result = µb.staticNetFilteringEngine.toResultString(loggerEnabled);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ var onBeforeRootFrameRequest = function(details) {
|
||||
|
||||
// Filtering
|
||||
if ( result === '' ) {
|
||||
if ( µb.staticNetFilteringEngine.matchString(context) ) {
|
||||
if ( µb.staticNetFilteringEngine.matchString(context) !== undefined ) {
|
||||
// We always need the long-form result here.
|
||||
result = µb.staticNetFilteringEngine.toResultString(true);
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
||||
|
Loading…
Reference in New Issue
Block a user