From 35b46cab4cb48eea93b792a8242d28deab47fb21 Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 30 Aug 2016 22:45:24 -0400 Subject: [PATCH] code review re. 60f60c2c97037c55f1217882e62ed71ece7ea3af --- src/js/static-net-filtering.js | 7 +++++-- src/js/traffic.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 18140f798..bac96673c 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -55,6 +55,7 @@ var ThirdParty = 2 << 2; var AnyType = 0 << 4; var typeNameToTypeValue = { + 'notype': 0 << 4, 'stylesheet': 1 << 4, 'image': 2 << 4, 'object': 3 << 4, @@ -2432,8 +2433,10 @@ FilterContainer.prototype.matchString = function(context) { // https://github.com/chrisaljoudi/uBlock/issues/519 // Use exact type match for anything beyond `other` // Also, be prepared to support unknown types - var type = typeNameToTypeValue[context.requestType] || typeOtherValue; - if ( type > typeOtherValue ) { + var type = typeNameToTypeValue[context.requestType]; + if ( type === undefined ) { + type = typeOtherValue; + } else if ( type > typeOtherValue ) { return this.matchStringExactType(context, context.requestURL, context.requestType); } diff --git a/src/js/traffic.js b/src/js/traffic.js index e79fd16f9..043526c9d 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -169,7 +169,7 @@ var onBeforeRootFrameRequest = function(details) { pageDomain: requestDomain, requestURL: requestURL, requestHostname: requestHostname, - requestType: 'main_frame' + requestType: 'notype' }; var result = '';