1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00
gorhill 2017-01-18 13:01:13 -05:00
parent 54032e520b
commit 69fc59305e

View File

@ -561,26 +561,23 @@ vAPI.tabs.onPopupUpdated = (function() {
context.requestHostname = µb.URI.hostnameFromURI(targetURL); context.requestHostname = µb.URI.hostnameFromURI(targetURL);
context.requestType = 'popup'; context.requestType = 'popup';
// https://github.com/gorhill/uBlock/commit/1d448b85b2931412508aa01bf899e0b6f0033626#commitcomment-14944764
// Ignore bad target URL. On Firefox, an `about:blank` tab may be
// opened for a new tab before it is filled in with the real target
// URL.
// 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.
// https://github.com/uBlockOrigin/uAssets/issues/255 // https://github.com/uBlockOrigin/uAssets/issues/255
// Do not bail out on `about:blank`: an `about:blank` popup can be // Do not bail out on `about:blank`: an `about:blank` popup can be
// opened, with the sole purpose to serve as an intermediary in // opened, with the sole purpose to serve as an intermediary in
// a sequence of chained popups. // a sequence of chained popups.
if ( // https://github.com/uBlockOrigin/uAssets/issues/263#issuecomment-272615772
context.requestHostname === '' && // Do not bail out, period: the static filtering engine must be
targetURL.startsWith('data:') === false && // able to examine all sorts of URLs for popup filtering purpose.
targetURL !== 'about:blank'
) {
return '';
}
// Dynamic filtering makes sense only when we have a valid hostname. // Dynamic filtering makes sense only when we have a valid opener
if ( openerHostname !== '' ) { // hostname.
// https://github.com/gorhill/uBlock/commit/1d448b85b2931412508aa01bf899e0b6f0033626#commitcomment-14944764
// Ignore bad target URL. On Firefox, an `about:blank` tab may be
// opened for a new tab before it is filled in with the real target
// URL.
if ( openerHostname !== '' && targetURL !== 'about:blank' ) {
// Check per-site switch first // Check per-site switch first
if ( µb.hnSwitches.evaluateZ('no-popups', openerHostname) ) { if ( µb.hnSwitches.evaluateZ('no-popups', openerHostname) ) {
if ( typeof clickedURL === 'string' && areDifferentURLs(targetURL, clickedURL) ) { if ( typeof clickedURL === 'string' && areDifferentURLs(targetURL, clickedURL) ) {