From a659c520f00395e81d3aaae3a637126aa2a16a00 Mon Sep 17 00:00:00 2001 From: Glen Lowland Date: Thu, 25 May 2023 18:12:59 +0100 Subject: [PATCH] Fix "Search LibRedirect" from context menu When you try to select a text on a page and click a "Search LibRedirect" on Google Chrome - it does not redirect to the frontend and shows error page. After an investigation and debug, I saw Chrome passes details.initiator = "null" for such requests. Handle this case in code and allow redirects. --- src/pages/background/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 3b3dd54..7652d72 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -36,7 +36,7 @@ browser.webRequest.onBeforeRequest.addListener( let initiator try { if (details.originUrl) initiator = new URL(details.originUrl) - else if (details.initiator) initiator = new URL(details.initiator) + else if (details.initiator && details.initiator !== "null") initiator = new URL(details.initiator) } catch { return null }