Exclude trusted sites from no-popups-switch

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1616
This commit is contained in:
Raymond Hill 2021-06-24 11:02:06 -04:00
parent ad15a5dd51
commit 81521256e7
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 17 additions and 12 deletions

View File

@ -108,11 +108,21 @@
targetURL, targetURL,
popupType = 'popup' popupType = 'popup'
) { ) {
// https://github.com/chrisaljoudi/uBlock/issues/323
// https://github.com/chrisaljoudi/uBlock/issues/1142
// https://github.com/uBlockOrigin/uBlock-issues/issues/1616
// Don't block if uBO is turned off in popup's context
if (
µb.getNetFilteringSwitch(targetURL) === false ||
µb.getNetFilteringSwitch(µb.normalizePageURL(0, targetURL)) === false
) {
return 0;
}
fctxt.setTabOriginFromURL(rootOpenerURL) fctxt.setTabOriginFromURL(rootOpenerURL)
.setDocOriginFromURL(localOpenerURL || rootOpenerURL) .setDocOriginFromURL(localOpenerURL || rootOpenerURL)
.setURL(targetURL) .setURL(targetURL)
.setType('popup'); .setType('popup');
let result;
// https://github.com/gorhill/uBlock/issues/1735 // https://github.com/gorhill/uBlock/issues/1735
// Do not bail out on `data:` URI, they are commonly used for popups. // Do not bail out on `data:` URI, they are commonly used for popups.
@ -153,7 +163,7 @@
// https://github.com/gorhill/uBlock/issues/581 // https://github.com/gorhill/uBlock/issues/581
// Take into account popup-specific rules in dynamic URL // Take into account popup-specific rules in dynamic URL
// filtering, OR generic allow rules. // filtering, OR generic allow rules.
result = µb.sessionURLFiltering.evaluateZ( let result = µb.sessionURLFiltering.evaluateZ(
fctxt.getTabHostname(), fctxt.getTabHostname(),
targetURL, targetURL,
popupType popupType
@ -181,16 +191,11 @@
} }
} }
// https://github.com/chrisaljoudi/uBlock/issues/323 fctxt.type = popupType;
// https://github.com/chrisaljoudi/uBlock/issues/1142 const result = µb.staticNetFilteringEngine.matchString(fctxt, 0b0001);
// Don't block if uBlock is turned off in popup's context if ( result !== 0 ) {
if ( µb.getNetFilteringSwitch(targetURL) ) { fctxt.filter = µb.staticNetFilteringEngine.toLogData();
fctxt.type = popupType; return result;
result = µb.staticNetFilteringEngine.matchString(fctxt, 0b0001);
if ( result !== 0 ) {
fctxt.filter = µb.staticNetFilteringEngine.toLogData();
return result;
}
} }
return 0; return 0;