summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-19 01:12:16 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-19 01:12:16 +0200
commite6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (patch)
tree321844f5a525ffabd10ff960a32fea9cd3c1d5b8
parent8d8f48fb14f1316a4dac63f325bef80c8a4ebf96 (diff)
downloadwallet-core-e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa.tar.gz
wallet-core-e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa.tar.bz2
wallet-core-e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa.zip
don't fail hard when getImageData is not allowed
-rw-r--r--src/chromeBadge.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/chromeBadge.ts b/src/chromeBadge.ts
index df12fba83..369a95227 100644
--- 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 ...
+ }
}
}