1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-02 00:42:45 +01:00

code review re. 60f60c2c97

This commit is contained in:
gorhill 2016-08-30 22:45:24 -04:00
parent 83e66b36f1
commit 35b46cab4c
2 changed files with 6 additions and 3 deletions

View File

@ -55,6 +55,7 @@ var ThirdParty = 2 << 2;
var AnyType = 0 << 4; var AnyType = 0 << 4;
var typeNameToTypeValue = { var typeNameToTypeValue = {
'notype': 0 << 4,
'stylesheet': 1 << 4, 'stylesheet': 1 << 4,
'image': 2 << 4, 'image': 2 << 4,
'object': 3 << 4, 'object': 3 << 4,
@ -2432,8 +2433,10 @@ FilterContainer.prototype.matchString = function(context) {
// https://github.com/chrisaljoudi/uBlock/issues/519 // https://github.com/chrisaljoudi/uBlock/issues/519
// Use exact type match for anything beyond `other` // Use exact type match for anything beyond `other`
// Also, be prepared to support unknown types // Also, be prepared to support unknown types
var type = typeNameToTypeValue[context.requestType] || typeOtherValue; var type = typeNameToTypeValue[context.requestType];
if ( type > typeOtherValue ) { if ( type === undefined ) {
type = typeOtherValue;
} else if ( type > typeOtherValue ) {
return this.matchStringExactType(context, context.requestURL, context.requestType); return this.matchStringExactType(context, context.requestURL, context.requestType);
} }

View File

@ -169,7 +169,7 @@ var onBeforeRootFrameRequest = function(details) {
pageDomain: requestDomain, pageDomain: requestDomain,
requestURL: requestURL, requestURL: requestURL,
requestHostname: requestHostname, requestHostname: requestHostname,
requestType: 'main_frame' requestType: 'notype'
}; };
var result = ''; var result = '';