diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-19 23:03:58 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-19 23:03:58 +0100 |
commit | 7b1511a243aa322462d29d15f19f9c2a8bfc67ef (patch) | |
tree | 1b8f0473a4ca25935c1e033de8ef1613826964b0 /src/wxBackend.ts | |
parent | 65bbbf53ee73f7b72c1531d03d3943eb82b78e99 (diff) | |
download | wallet-core-7b1511a243aa322462d29d15f19f9c2a8bfc67ef.tar.xz |
circumvent chrome bug for JS-less wallet detection
Diffstat (limited to 'src/wxBackend.ts')
-rw-r--r-- | src/wxBackend.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/wxBackend.ts b/src/wxBackend.ts index 6e637a2a6..e8f10cf5c 100644 --- a/src/wxBackend.ts +++ b/src/wxBackend.ts @@ -453,10 +453,37 @@ export function wxMain() { chrome.tabs.executeScript(tab.id, { file: "/src/vendor/URI.js" }); chrome.tabs.executeScript(tab.id, { file: "/src/taler-wallet-lib.js" }); chrome.tabs.executeScript(tab.id, { file: "/src/content_scripts/notify.js" }); + let code = ` + if (document.documentElement.getAttribute("data-taler-nojs")) { + document.dispatchEvent(new Event("taler-probe-result")); + } + `; + chrome.tabs.executeScript(tab.id, { code, runAt: "document_idle" }); } } }); + chrome.tabs.onUpdated.addListener((tabId, changeInfo) => { + if (changeInfo.status != 'complete') { + return; + } + chrome.tabs.get(tabId, (tab) => { + if (!tab.url || !tab.id) { + return; + } + let code = ` + if (document.documentElement.getAttribute("data-taler-nojs")) { + document.dispatchEvent(new Event("taler-probe-result")); + } + `; + let run = () => { + chrome.tabs.executeScript(tab.id!, { code, runAt: "document_idle" }); + }; + chrome.extension.getBackgroundPage().setTimeout(run, 300); + }); + + }); + chrome.extension.getBackgroundPage().setInterval(clearRateLimitCache, 5000); Promise.resolve() |