mirror of https://github.com/gorhill/uBlock.git
this fixes #581
dynamic `allow` rules must also override the blocking of popups by static filters.
This commit is contained in:
parent
ccb058c2d9
commit
f29628ee01
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue