From 2c4c33c6b5f604ef744ebd95ae28418c6f8ca446 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Sat, 27 Jan 2018 18:37:57 -0800 Subject: [PATCH] Fall back to static icon on privacy.resistFingerprinting. Fix #1357. --- omega-target-chromium-extension/src/coffee/background.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/omega-target-chromium-extension/src/coffee/background.coffee b/omega-target-chromium-extension/src/coffee/background.coffee index ab94fe48..68c0e45f 100644 --- a/omega-target-chromium-extension/src/coffee/background.coffee +++ b/omega-target-chromium-extension/src/coffee/background.coffee @@ -57,10 +57,15 @@ drawIcon = (resultColor, profileColor) -> drawOmega drawContext, profileColor drawContext.setTransform(1, 0, 0, 1, 0, 0) icon[size] = drawContext.getImageData(0, 0, size, size) + if icon[size].data[3] == 255 + # Some browsers may replace the image data with a opaque white image to + # resist fingerprinting. In that case the icon cannot be drawn. + throw new Error('Icon drawing blocked by privacy.resistFingerprinting.') catch e if not drawError? drawError = e Log.error(e) + Log.error('Profile-colored icon disabled. Falling back to static icon.') icon = null return iconCache[cacheKey] = icon