mirror of https://github.com/gorhill/uBlock.git
this fixes #1305
This commit is contained in:
parent
5a9f3fa6fe
commit
f39d87f6e0
|
@ -154,7 +154,7 @@ var contentObserver = {
|
||||||
.outerWindowID;
|
.outerWindowID;
|
||||||
},
|
},
|
||||||
|
|
||||||
handlePopup: function(location, context) {
|
handlePopup: function(location, origin, context) {
|
||||||
let openeeContext = context.contentWindow || context;
|
let openeeContext = context.contentWindow || context;
|
||||||
if (
|
if (
|
||||||
typeof openeeContext.opener !== 'object' ||
|
typeof openeeContext.opener !== 'object' ||
|
||||||
|
@ -168,10 +168,19 @@ var contentObserver = {
|
||||||
// Use location of top window, not that of a frame, as this
|
// Use location of top window, not that of a frame, as this
|
||||||
// would cause tab id lookup (necessary for popup blocking) to
|
// would cause tab id lookup (necessary for popup blocking) to
|
||||||
// always fail.
|
// always fail.
|
||||||
let openerURL = openeeContext.opener.top &&
|
// Opener could be a dead object, using it would cause a throw.
|
||||||
openeeContext.opener.top.location.href;
|
// 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 ) {
|
if ( openerURL === null ) {
|
||||||
return;
|
openerURL = origin.asciiSpec;
|
||||||
}
|
}
|
||||||
let messageManager = getMessageManager(openeeContext);
|
let messageManager = getMessageManager(openeeContext);
|
||||||
if ( messageManager === null ) {
|
if ( messageManager === null ) {
|
||||||
|
@ -204,7 +213,7 @@ var contentObserver = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type === this.MAIN_FRAME ) {
|
if ( type === this.MAIN_FRAME ) {
|
||||||
this.handlePopup(location, context);
|
this.handlePopup(location, origin, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !location.schemeIs('http') && !location.schemeIs('https') ) {
|
if ( !location.schemeIs('http') && !location.schemeIs('https') ) {
|
||||||
|
|
Loading…
Reference in New Issue