From 95b85534ccb2a05dbaeeae42426ad14af009e9ca Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Thu, 27 Jul 2023 15:01:10 +0100 Subject: [PATCH] fix: firefox manually loaded extension --- src/content-scripts/content-script.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/content-scripts/content-script.ts b/src/content-scripts/content-script.ts index ae584a87d29..245a80a8564 100755 --- a/src/content-scripts/content-script.ts +++ b/src/content-scripts/content-script.ts @@ -128,9 +128,12 @@ document.addEventListener(DomEventName.psbtRequest, ((event: PsbtRequestEvent) = }); }) as EventListener); -window.addEventListener('load', () => { +function addHiroWalletToPage() { const inpage = document.createElement('script'); inpage.src = chrome.runtime.getURL('inpage.js'); - inpage.id = 'stacks-wallet-provider'; + inpage.id = 'hiro-wallet-provider'; document.body.appendChild(inpage); -}); +} + +// Don't block thread to add Hiro Wallet to page +requestAnimationFrame(() => addHiroWalletToPage());