mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
synthetic context for blocked popup testing missing property members
This commit is contained in:
parent
58159e3c05
commit
029a37596d
@ -182,23 +182,25 @@ var onBeforeSendHeaders = function(details) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
|
||||||
var µburi = µb.URI;
|
|
||||||
var referrerHostname = µburi.hostnameFromURI(referrer);
|
|
||||||
var pageDetails = {
|
|
||||||
pageHostname: referrerHostname,
|
|
||||||
pageDomain: µburi.domainFromHostname(referrerHostname)
|
|
||||||
};
|
|
||||||
//console.debug('Referrer="%s"', referrer);
|
|
||||||
|
|
||||||
// TODO: I think I should test the switch of the referrer instead, not the
|
// 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
|
// 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
|
// a page store from a URL. Have to keep in mind the same URL can appear
|
||||||
// in multiple tabs.
|
// in multiple tabs.
|
||||||
var result = '';
|
var result = '';
|
||||||
if ( pageStore.getNetFilteringSwitch() ) {
|
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.
|
||||||
|
// Create a synthetic context based on the referrer.
|
||||||
|
var µburi = µb.URI;
|
||||||
|
var referrerHostname = µburi.hostnameFromURI(referrer);
|
||||||
|
var pageDetails = {
|
||||||
|
pageHostname: referrerHostname,
|
||||||
|
pageDomain: µburi.domainFromHostname(referrerHostname),
|
||||||
|
};
|
||||||
|
pageDetails.rootHostname = pageDetails.pageHostname;
|
||||||
|
pageDetails.rootDomain = pageDetails.pageDomain;
|
||||||
|
//console.debug('Referrer="%s"', referrer);
|
||||||
result = µb.netFilteringEngine.matchStringExactType(pageDetails, requestURL, 'popup');
|
result = µb.netFilteringEngine.matchStringExactType(pageDetails, requestURL, 'popup');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user