diff options
author | Sebastian <sebasjm@gmail.com> | 2022-03-15 17:46:09 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-03-15 17:46:46 -0300 |
commit | e84cb958878582638681897ccb5745508e825005 (patch) | |
tree | 45312417384a84cd052f2387c36bae9c2b21d166 /packages/taler-wallet-webextension/src | |
parent | c0be242292a770c4dbe6d5ed86343014d14e9a33 (diff) | |
download | wallet-core-e84cb958878582638681897ccb5745508e825005.tar.xz |
chrome.tabs.update does not work on async request interception, so using a delay
Diffstat (limited to 'packages/taler-wallet-webextension/src')
-rw-r--r-- | packages/taler-wallet-webextension/src/wxBackend.ts | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts b/packages/taler-wallet-webextension/src/wxBackend.ts index 66debf266..643735147 100644 --- a/packages/taler-wallet-webextension/src/wxBackend.ts +++ b/packages/taler-wallet-webextension/src/wxBackend.ts @@ -226,20 +226,18 @@ function makeSyncWalletRedirect( .join("&"); innerUrl.hash = innerUrl.hash + "?" + hParams; } - // if (isFirefox()) { - // // Some platforms don't support the sync redirect (yet), so fall back to - // // async redirect after a timeout. - // const doit = async (): Promise<void> => { - // await waitMs(150); - // const tab = await getTab(tabId); - // if (tab.url === oldUrl) { - // chrome.tabs.update(tabId, { url: innerUrl.href }); - // } - // }; - // doit(); - // } - console.log("redirecting to", innerUrl.href); - chrome.tabs.update(tabId, { url: innerUrl.href }); + // Some platforms don't support the sync redirect (yet), so fall back to + // async redirect after a timeout. + const doit = async (): Promise<void> => { + await waitMs(150); + const tab = await getTab(tabId); + if (tab.url === oldUrl) { + console.log("redirecting to", innerUrl.href); + chrome.tabs.update(tabId, { url: innerUrl.href }); + } + }; + doit(); + return { redirectUrl: innerUrl.href }; } |