1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00

code review: result can be non-blocking yet non-empty

This commit is contained in:
gorhill 2015-06-09 11:48:13 -04:00
parent 643bb3dcd2
commit fa3b4c887c
4 changed files with 7 additions and 7 deletions

View File

@ -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());
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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