circumvent chrome bug for JS-less wallet detection
This commit is contained in:
parent
65bbbf53ee
commit
7b1511a243
@ -43,6 +43,9 @@ var TalerNotify;
|
||||
console.error("Taler wallet lib not included, HTTP 402 payments not" +
|
||||
" supported");
|
||||
}
|
||||
if (document.documentElement.getAttribute("data-taler-nojs")) {
|
||||
document.dispatchEvent(new Event("taler-probe-result"));
|
||||
}
|
||||
function subst(url, H_contract) {
|
||||
url = url.replace("${H_contract}", H_contract);
|
||||
url = url.replace("${$}", "$");
|
||||
|
@ -43,6 +43,11 @@ namespace TalerNotify {
|
||||
" supported");
|
||||
}
|
||||
|
||||
if (document.documentElement.getAttribute("data-taler-nojs")) {
|
||||
document.dispatchEvent(new Event("taler-probe-result"));
|
||||
}
|
||||
|
||||
|
||||
function subst(url: string, H_contract: string) {
|
||||
url = url.replace("${H_contract}", H_contract);
|
||||
url = url.replace("${$}", "$");
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user