mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
This commit is contained in:
parent
854d5febaf
commit
e247f28b73
1 changed files with 13 additions and 9 deletions
|
@ -461,14 +461,17 @@ vAPI.tabs.onPopup = function(details) {
|
|||
if ( tabContext.tabId === details.openerTabId ) {
|
||||
openerURL = tabContext.normalURL;
|
||||
}
|
||||
|
||||
if ( openerURL === '' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var µburi = µb.URI;
|
||||
var openerHostname = µburi.hostnameFromURI(openerURL);
|
||||
var openerDomain = µburi.domainFromHostname(openerHostname);
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/341
|
||||
// Allow popups if uBlock is turned off in opener's context.
|
||||
if ( µb.getNetFilteringSwitch(openerURL) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var targetURL = details.targetURL;
|
||||
|
||||
|
@ -481,6 +484,8 @@ vAPI.tabs.onPopup = function(details) {
|
|||
}
|
||||
}
|
||||
|
||||
var openerHostname = µburi.hostnameFromURI(openerURL);
|
||||
var openerDomain = µburi.domainFromHostname(openerHostname);
|
||||
var context = {
|
||||
pageHostname: openerHostname,
|
||||
pageDomain: openerDomain,
|
||||
|
@ -501,22 +506,21 @@ vAPI.tabs.onPopup = function(details) {
|
|||
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/323
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/1142
|
||||
// If popup OR opener URL is whitelisted, do not block the popup
|
||||
// Don't block if uBlock is turned off in popup's context
|
||||
if (
|
||||
result === '' &&
|
||||
µb.getNetFilteringSwitch(openerURL) &&
|
||||
µb.getNetFilteringSwitch(targetURL)
|
||||
µb.getNetFilteringSwitch(targetURL) &&
|
||||
µb.staticNetFilteringEngine.matchStringExactType(context, targetURL, 'popup') !== undefined
|
||||
) {
|
||||
if ( µ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 ( loggerEnabled ) {
|
||||
µb.logger.writeOne(
|
||||
details.openerTabId,
|
||||
|
|
Loading…
Reference in a new issue