diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 0e72d330b..1a798e9f6 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1353,7 +1353,7 @@ var tabWatcher = (function() { tabs = []; } - var browser, URI, tabId; + var browser, tabId; var tabindex = tabs.length, tab; while ( tabindex-- ) { tab = tabs[tabindex]; @@ -1361,11 +1361,6 @@ var tabWatcher = (function() { if ( browser === null ) { continue; } - URI = browser.currentURI; - // Close extension tabs - if ( URI.schemeIs('chrome') && URI.host === location.host ) { - vAPI.tabs._remove(tab, getTabBrowser(win)); - } tabId = browserToTabIdMap.get(browser); if ( tabId !== undefined ) { removeBrowserEntry(tabId, browser); diff --git a/platform/firefox/vapi-client.js b/platform/firefox/vapi-client.js index f748b5d5a..f09577aaa 100644 --- a/platform/firefox/vapi-client.js +++ b/platform/firefox/vapi-client.js @@ -193,6 +193,17 @@ vAPI.messaging = { if ( typeof self.outerShutdown === 'function' ) { outerShutdown(); } + // https://github.com/gorhill/uBlock/issues/1573 + // Will let uBO's own web pages close themselves. `window.top` is + // used on the assumption that uBO's own web pages will never be + // embedded in anything else than its own documents. + try { + var top = window.top; + if ( top.location.href.startsWith(vAPI.getURL('')) ) { + top.close(); + } + } catch (ex) { + } return; } },