gorhill 2015-06-14 07:46:58 -04:00
parent 854d5febaf
commit e247f28b73

View file

@ -461,14 +461,17 @@ vAPI.tabs.onPopup = function(details) {
if ( tabContext.tabId === details.openerTabId ) { if ( tabContext.tabId === details.openerTabId ) {
openerURL = tabContext.normalURL; openerURL = tabContext.normalURL;
} }
if ( openerURL === '' ) { if ( openerURL === '' ) {
return; return;
} }
var µburi = µb.URI; 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; 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 = { var context = {
pageHostname: openerHostname, pageHostname: openerHostname,
pageDomain: openerDomain, pageDomain: openerDomain,
@ -501,15 +506,13 @@ vAPI.tabs.onPopup = function(details) {
// https://github.com/chrisaljoudi/uBlock/issues/323 // https://github.com/chrisaljoudi/uBlock/issues/323
// https://github.com/chrisaljoudi/uBlock/issues/1142 // 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 ( if (
result === '' && 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);
result = µb.staticNetFilteringEngine.toResultString(loggerEnabled);
}
} }
// https://github.com/chrisaljoudi/uBlock/issues/91 // https://github.com/chrisaljoudi/uBlock/issues/91
@ -517,6 +520,7 @@ vAPI.tabs.onPopup = function(details) {
if ( pageStore ) { if ( pageStore ) {
pageStore.logRequest(context, result); pageStore.logRequest(context, result);
} }
if ( loggerEnabled ) { if ( loggerEnabled ) {
µb.logger.writeOne( µb.logger.writeOne(
details.openerTabId, details.openerTabId,