don't fail hard when getImageData is not allowed
This commit is contained in:
parent
8d8f48fb14
commit
e6e0cbc387
@ -150,11 +150,16 @@ export class ChromeBadge implements Badge {
|
|||||||
|
|
||||||
// Allow running outside the extension for testing
|
// Allow running outside the extension for testing
|
||||||
if (window["chrome"] && window.chrome["browserAction"]) {
|
if (window["chrome"] && window.chrome["browserAction"]) {
|
||||||
let imageData = this.ctx.getImageData(0,
|
try {
|
||||||
0,
|
let imageData = this.ctx.getImageData(0,
|
||||||
this.canvas.width,
|
0,
|
||||||
this.canvas.height);
|
this.canvas.width,
|
||||||
chrome.browserAction.setIcon({imageData});
|
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 ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user