From 3632c1821e7bde9caf3d10f38e9b527c7ee3f7dc Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 29 Jul 2020 07:13:08 -0400 Subject: [PATCH] Tabs opened from about:newtab are not popup candidates Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1184 --- src/js/tab.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/js/tab.js b/src/js/tab.js index 2e978163d..55b400dd5 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -513,6 +513,10 @@ housekeep itself. } }; + // https://github.com/uBlockOrigin/uBlock-issues/issues/1184 + // Do not consider a tab opened from `about:newtab` to be a popup + // candidate. + const onTabCreated = async function(createDetails) { const { sourceTabId, sourceFrameId, tabId } = createDetails; const popup = popupCandidates.get(tabId); @@ -533,6 +537,13 @@ housekeep itself. catch (reason) { return; } + if ( + Array.isArray(openerDetails) === false || + openerDetails.length !== 2 || + openerDetails[1].url === 'about:newtab' + ) { + return; + } popupCandidates.set( tabId, new PopupCandidate(createDetails, openerDetails)