mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 18:32:45 +01:00
this fixes #1305
This commit is contained in:
parent
5a9f3fa6fe
commit
f39d87f6e0
@ -154,7 +154,7 @@ var contentObserver = {
|
||||
.outerWindowID;
|
||||
},
|
||||
|
||||
handlePopup: function(location, context) {
|
||||
handlePopup: function(location, origin, context) {
|
||||
let openeeContext = context.contentWindow || context;
|
||||
if (
|
||||
typeof openeeContext.opener !== 'object' ||
|
||||
@ -168,10 +168,19 @@ var contentObserver = {
|
||||
// Use location of top window, not that of a frame, as this
|
||||
// would cause tab id lookup (necessary for popup blocking) to
|
||||
// always fail.
|
||||
let openerURL = openeeContext.opener.top &&
|
||||
openeeContext.opener.top.location.href;
|
||||
// Opener could be a dead object, using it would cause a throw.
|
||||
// Repro case:
|
||||
// - Open http://delishows.to/show/chicago-med/season/1/episode/6
|
||||
// - Click anywhere in the background
|
||||
let openerURL = null;
|
||||
try {
|
||||
let opener = openeeContext.opener.top || openeeContext.opener;
|
||||
openerURL = opener.location && opener.location.href;
|
||||
} catch(ex) {
|
||||
}
|
||||
// If no valid opener URL found, use the origin URL.
|
||||
if ( openerURL === null ) {
|
||||
return;
|
||||
openerURL = origin.asciiSpec;
|
||||
}
|
||||
let messageManager = getMessageManager(openeeContext);
|
||||
if ( messageManager === null ) {
|
||||
@ -204,7 +213,7 @@ var contentObserver = {
|
||||
}
|
||||
|
||||
if ( type === this.MAIN_FRAME ) {
|
||||
this.handlePopup(location, context);
|
||||
this.handlePopup(location, origin, context);
|
||||
}
|
||||
|
||||
if ( !location.schemeIs('http') && !location.schemeIs('https') ) {
|
||||
|
Loading…
Reference in New Issue
Block a user