Firefox: fix tab closing issue (pop-up blocking)

This commit is contained in:
Deathamns 2015-01-15 15:58:14 +01:00
parent 97b5ad9ad5
commit 32c7bf854b
2 changed files with 15 additions and 4 deletions

View File

@ -127,7 +127,9 @@ const contentObserver = {
context = context.contentWindow || context; context = context.contentWindow || context;
try { try {
if ( context !== context.opener ) {
openerURL = context.opener.location.href; openerURL = context.opener.location.href;
}
} catch (ex) {} } catch (ex) {}
let isPopup = location.spec === 'about:blank' && openerURL; let isPopup = location.spec === 'about:blank' && openerURL;
@ -139,7 +141,9 @@ const contentObserver = {
context = context.contentWindow || context; context = context.contentWindow || context;
try { try {
if ( context !== context.opener ) {
openerURL = context.opener.location.href; openerURL = context.opener.location.href;
}
} catch (ex) {} } catch (ex) {}
} else { } else {
context = (context.ownerDocument || context).defaultView; context = (context.ownerDocument || context).defaultView;

View File

@ -980,10 +980,17 @@ var httpObserver = {
var tabURI = tab.linkedBrowser.currentURI; var tabURI = tab.linkedBrowser.currentURI;
// Probably isn't the best method to identify the source tab // Probably isn't the best method to identify the source tab
if ( tabURI.spec === this.lastRequest.openerURL ) { if ( tabURI.spec !== lastRequest.openerURL ) {
continue
}
sourceTabId = vAPI.tabs.getTabId(tab); sourceTabId = vAPI.tabs.getTabId(tab);
if ( sourceTabId !== lastRequest.tabId ) {
break; break;
} }
sourceTabId = null;
} }
if ( this.handlePopup(channel.URI, lastRequest.tabId, sourceTabId) ) { if ( this.handlePopup(channel.URI, lastRequest.tabId, sourceTabId) ) {