mirror of https://github.com/gorhill/uBlock.git
this fixes #323
This commit is contained in:
parent
49df5e0ec6
commit
bafc6360b8
14
js/tab.js
14
js/tab.js
|
@ -64,17 +64,23 @@
|
|||
if ( !pageStore ) {
|
||||
return;
|
||||
}
|
||||
if ( pageStore.getNetFilteringSwitch() !== true ) {
|
||||
return;
|
||||
}
|
||||
var requestURL = details.url;
|
||||
var result = µb.netFilteringEngine.matchStringExactType(pageStore, requestURL, 'popup');
|
||||
var result = '';
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/323
|
||||
// If popup URL is whitelisted, do not block it
|
||||
if ( µb.getNetFilteringSwitch(requestURL) ) {
|
||||
result = µb.netFilteringEngine.matchStringExactType(pageStore, requestURL, 'popup');
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/91
|
||||
pageStore.recordResult('popup', requestURL, result);
|
||||
|
||||
// Not blocked
|
||||
if ( pageStore.boolFromResult(result) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Blocked
|
||||
// It is a popup, block and remove the tab.
|
||||
µb.unbindTabFromPageStats(details.tabId);
|
||||
|
|
|
@ -172,12 +172,16 @@ var onBeforeSendHeaders = function(details) {
|
|||
return;
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/323
|
||||
if ( pageStore.getNetFilteringSwitch() === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: I think I should test the switch of the referrer instead, not the
|
||||
// switch of the popup. If so, that would require being able to lookup
|
||||
// a page store from a URL. Have to keep in mind the same URL can appear
|
||||
// in multiple tabs.
|
||||
var result = '';
|
||||
if ( pageStore.getNetFilteringSwitch() ) {
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/67
|
||||
// We need to pass the details of the page which opened this popup,
|
||||
// so that the `third-party` option works.
|
||||
|
@ -191,8 +195,7 @@ var onBeforeSendHeaders = function(details) {
|
|||
pageDetails.rootHostname = pageDetails.pageHostname;
|
||||
pageDetails.rootDomain = pageDetails.pageDomain;
|
||||
//console.debug('Referrer="%s"', referrer);
|
||||
result = µb.netFilteringEngine.matchStringExactType(pageDetails, requestURL, 'popup');
|
||||
}
|
||||
var result = µb.netFilteringEngine.matchStringExactType(pageDetails, requestURL, 'popup');
|
||||
|
||||
// Not blocked?
|
||||
if ( result === '' || result.slice(0, 2) === '@@' ) {
|
||||
|
|
Loading…
Reference in New Issue