taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa
parent 8d8f48fb14f1316a4dac63f325bef80c8a4ebf96
Author: Florian Dold <florian.dold@gmail.com>
Date:   Wed, 19 Apr 2017 01:12:16 +0200

don't fail hard when getImageData is not allowed

Diffstat:
Msrc/chromeBadge.ts | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/chromeBadge.ts b/src/chromeBadge.ts @@ -150,11 +150,16 @@ export class ChromeBadge implements Badge { // Allow running outside the extension for testing if (window["chrome"] && window.chrome["browserAction"]) { - let imageData = this.ctx.getImageData(0, - 0, - this.canvas.width, - this.canvas.height); - chrome.browserAction.setIcon({imageData}); + try { + let imageData = this.ctx.getImageData(0, + 0, + this.canvas.width, + this.canvas.height); + chrome.browserAction.setIcon({imageData}); + } catch (e) { + // Might fail if browser has over-eager canvas fingerprinting countermeasures. + // There's nothing we can do then ... + } } }