Fall back to static icon on privacy.resistFingerprinting. Fix #1357.

This commit is contained in:
FelisCatus 2018-01-27 18:37:57 -08:00
parent 1e6696bd70
commit 2c4c33c6b5

View File

@ -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