aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-08-17 17:10:15 -0400
committergorhill <rhill@raymondhill.net>2015-08-17 17:10:15 -0400
commitf29628ee019031bf6e0f195cb4d0f6544664f3a4 (patch)
tree04d1146b6e2e7afaaf78c14eea1c45e652226c87 /src
parentccb058c2d96908060adc5a0209ca7bd293392d5d (diff)
downloaduBlock-f29628ee019031bf6e0f195cb4d0f6544664f3a4.zip
uBlock-f29628ee019031bf6e0f195cb4d0f6544664f3a4.tar.gz
uBlock-f29628ee019031bf6e0f195cb4d0f6544664f3a4.tar.bz2
this fixes #581
dynamic `allow` rules must also override the blocking of popups by static filters.
Diffstat (limited to 'src')
-rw-r--r--src/js/tab.js39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/js/tab.js b/src/js/tab.js
index 9a90c2b..a3b1d4a 100644
--- a/src/js/tab.js
+++ b/src/js/tab.js
@@ -496,29 +496,56 @@ vAPI.tabs.onPopup = function(details) {
requestType: 'popup'
};
- var pageStore = µb.pageStoreFromTabId(details.openerTabId);
var result = '';
+ var loggerEnabled = µb.logger.isEnabled();
// Check user switch first
if ( µb.hnSwitches.evaluateZ('no-popups', openerHostname) ) {
result = 'ub:no-popups: ' + µb.hnSwitches.z + ' true';
}
+ // https://github.com/gorhill/uBlock/issues/581
+ // Take into account popup-specific rules in dynamic URL filtering, OR
+ // generic allow rules.
+ if ( result === '' ) {
+ µb.sessionURLFiltering.evaluateZ(openerHostname, targetURL, 'popup');
+ if (
+ µb.sessionURLFiltering.r === 1 && µb.sessionURLFiltering.type === 'popup' ||
+ µb.sessionURLFiltering.r === 2
+ ) {
+ result = µb.sessionURLFiltering.toFilterString();
+ }
+ }
+
+ // https://github.com/gorhill/uBlock/issues/581
+ // Take into account `allow` rules in dynamic filtering: `block` rules
+ // are ignored, as block rules are not meant to block specific types
+ // like `popup` (just like with static filters).
+ if ( result === '' ) {
+ µb.sessionFirewall.evaluateCellZY(openerHostname, context.requestHostname, 'popup');
+ if ( µb.sessionFirewall.r === 2 ) {
+ result = µb.sessionFirewall.toFilterString();
+ }
+ }
+
// https://github.com/chrisaljoudi/uBlock/issues/323
// https://github.com/chrisaljoudi/uBlock/issues/1142
// Don't block if uBlock is turned off in popup's context
- // https://github.com/gorhill/uBlock/issues/581
- // Take into account dynamic filtering.
- if ( result === '' && pageStore && µb.getNetFilteringSwitch(targetURL) ) {
- result = pageStore.filterRequestNoCache(context);
+ if (
+ result === '' &&
+ µb.getNetFilteringSwitch(targetURL) &&
+ µb.staticNetFilteringEngine.matchStringExactType(context, targetURL, 'popup') !== undefined
+ ) {
+ result = µb.staticNetFilteringEngine.toResultString(loggerEnabled);
}
// https://github.com/chrisaljoudi/uBlock/issues/91
+ var pageStore = µb.pageStoreFromTabId(details.openerTabId);
if ( pageStore ) {
pageStore.logRequest(context, result);
}
- if ( µb.logger.isEnabled() ) {
+ if ( loggerEnabled ) {
µb.logger.writeOne(
details.openerTabId,
'net',