| Index: lib/contentPolicy.js |
| diff --git a/lib/contentPolicy.js b/lib/contentPolicy.js |
| index b0498da6ec3bf66b35e35d8d8114e99ad3477707..ada611f6d33982777fc6b3a0bd9eeec38bb5a948 100644 |
| --- a/lib/contentPolicy.js |
| +++ b/lib/contentPolicy.js |
| @@ -162,6 +162,9 @@ let Policy = exports.Policy = |
| let docDomain = getHostname(wndLocation); |
| let match = null; |
| let [sitekey, sitekeyWnd] = getSitekey(wnd); |
| + let genericblock = null; |
| + let generichide = null; |
| + |
| if (!match && Prefs.enabled) |
| { |
| let testWnd = wnd; |
| @@ -180,6 +183,23 @@ let Policy = exports.Policy = |
| RequestNotifier.addNodeData(testWnd.document, topWnd, Policy.type.DOCUMENT, getHostname(parentWndLocation), false, testWndLocation, match); |
| return true; |
| } |
| + else if (contentType != Policy.type.ELEMHIDE) |
|
Thomas Greiner
2015/08/28 10:28:24
Detail: The "else" keyword is redundant here due t
kzar
2015/09/03 12:37:02
Done.
|
| + { |
| + let parentDocDomain = getHostname(parentWndLocation); |
| + let genericblockMatch = defaultMatcher.matchesAny( |
| + testWndLocation, RegExpFilter.typeMap.GENERICBLOCK, |
| + parentDocDomain, false, testSitekey |
| + ); |
| + if (genericblockMatch instanceof WhitelistFilter) |
| + { |
| + genericblock = { |
| + match: genericblockMatch, |
| + parentDocDomain: parentDocDomain, |
| + testWnd: testWnd, |
| + testWndLocation: testWndLocation |
| + }; |
| + } |
| + } |
| if (testWnd.parent == testWnd) |
| break; |
| @@ -208,7 +228,9 @@ let Policy = exports.Policy = |
| let testWndLocation = parentWndLocation; |
| parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWindowLocation(testWnd.parent)); |
| let parentDocDomain = getHostname(parentWndLocation); |
| + |
| match = defaultMatcher.matchesAny(testWndLocation, RegExpFilter.typeMap.ELEMHIDE, parentDocDomain, false, sitekey); |
| + |
| if (match instanceof WhitelistFilter) |
| { |
| FilterStorage.increaseHitCount(match, wnd); |
| @@ -216,6 +238,20 @@ let Policy = exports.Policy = |
| return true; |
| } |
| + let generichideMatch = defaultMatcher.matchesAny( |
| + testWndLocation, RegExpFilter.typeMap.GENERICHIDE, |
| + parentDocDomain, false, sitekey |
| + ); |
| + if (generichideMatch instanceof WhitelistFilter) |
| + { |
| + generichide = { |
| + match: generichideMatch, |
| + parentDocDomain: parentDocDomain, |
| + testWnd: testWnd, |
| + testWndLocation: testWndLocation |
| + }; |
| + } |
| + |
| if (testWnd.parent == testWnd) |
| break; |
| else |
| @@ -236,6 +272,19 @@ let Policy = exports.Policy = |
| RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, false, locationText, exception); |
| return true; |
| } |
| + |
| + if (match && match.isGeneric() && generichide) |
|
Thomas Greiner
2015/08/28 10:28:24
I'd assume that checking for "generichide" first w
kzar
2015/09/03 12:37:02
Done.
|
| + { |
| + FilterStorage.increaseHitCount(generichide.match, wnd); |
| + RequestNotifier.addNodeData( |
| + generichide.testWnd.document, |
| + topWnd, contentType, |
| + generichide.parentDocDomain, |
| + false, generichide.testWndLocation, |
| + generichide.match |
| + ); |
| + return true; |
| + } |
| } |
| let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty(location, docDomain)); |
| @@ -243,11 +292,27 @@ let Policy = exports.Policy = |
| if (!match && Prefs.enabled && contentType in Policy.typeMask) |
| { |
| match = defaultMatcher.matchesAny(locationText, Policy.typeMask[contentType], docDomain, thirdParty, sitekey); |
| - if (match instanceof BlockingFilter && node.ownerDocument && !(contentType in Policy.nonVisual)) |
| + if (match instanceof BlockingFilter) |
| { |
| - let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fastcollapse); |
| - if (collapse || prefCollapse) |
| - schedulePostProcess(node); |
| + if (match.isGeneric() && genericblock) |
| + { |
| + FilterStorage.increaseHitCount(genericblock.match, wnd); |
| + RequestNotifier.addNodeData( |
| + genericblock.testWnd.document, |
| + topWnd, contentType, |
| + genericblock.parentDocDomain, |
| + false, genericblock.testWndLocation, |
| + genericblock.match |
| + ); |
| + return true; |
| + } |
| + |
| + if (node.ownerDocument && !(contentType in Policy.nonVisual)) |
| + { |
| + let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fastcollapse); |
| + if (collapse || prefCollapse) |
| + schedulePostProcess(node); |
| + } |
| } |
| // Track mouse events for objects |