From 4863f3093ee1c1c9edaaad2e9acbd13a1691b599 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 28 Oct 2022 11:07:46 -0400 Subject: [PATCH] Do not inject scriptlets on navigation events in Firefox Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2343 --- src/js/tab.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/tab.js b/src/js/tab.js index 48dd9e32b..c6da477f8 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -916,6 +916,10 @@ vAPI.Tabs = class extends vAPI.Tabs { // For non-network URIs, defer scriptlet injection to content script. The // reason for this is that we need the effective URL and this information // is not available at this point. + // + // https://github.com/uBlockOrigin/uBlock-issues/issues/2343 + // uBO's isolated world in Firefox just does not work as expected at + // point, so we have to wait before injecting scriptlets. onNavigation(details) { super.onNavigation(details); const { frameId, tabId, url } = details; @@ -929,7 +933,10 @@ vAPI.Tabs = class extends vAPI.Tabs { const pageStore = µb.pageStoreFromTabId(tabId); if ( pageStore === null ) { return; } pageStore.setFrameURL(details); - if ( pageStore.getNetFilteringSwitch() ) { + if ( + vAPI.webextFlavor.soup.has('firefox') === false && + pageStore.getNetFilteringSwitch() + ) { scriptletFilteringEngine.injectNow(details); } }