From 5bab0587352696ffb014f58c34f8366dd3ae5f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Fri, 21 Jun 2024 11:45:05 +0300 Subject: [PATCH] Add an injection blacklist. Addresses #483 Fixes Zotero Connector breaking LastPass vault --- src/browserExt/background.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/browserExt/background.js b/src/browserExt/background.js index 9b613169d..350f8bd9e 100644 --- a/src/browserExt/background.js +++ b/src/browserExt/background.js @@ -27,6 +27,13 @@ if (!Zotero.isManifestV3) { browser.action = browser.browserAction; } +// Some websites break when injecting translation sandbox iframe into +// the website's first iframe (which we do for websites like ebscohost +// where often the translatable site is not the top frame, but first child frame). +const INJECTION_BLACKLIST = new Set([ + 'lastpass.com' +]) + Zotero.Connector_Browser = new function() { var _tabInfo = {}; var _incompatibleVersionMessageShown; @@ -258,6 +265,10 @@ Zotero.Connector_Browser = new function() { // Injected via the manifest file return; } else { + if (Zotero.isManifestV3) { + const host = new URL(url).host; + if (INJECTION_BLACKLIST.has(host)) return; + } let tabInfo = this.getTabInfo(tab.id); if (!tabInfo.frameChecked) { // Also in the first frame detected