]> cat aescling's git repositories - mastodon.git/commit
Fix image uploads being random data when canvas read access is blocked (#15180)
authorThibG <thib@sitedethib.com>
Wed, 18 Nov 2020 17:01:58 +0000 (18:01 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Nov 2020 17:01:58 +0000 (18:01 +0100)
commitd8d43a427a549cf063de3f6b3c22a08a06f53ffa
treeb1aa09485c274950685e91cf48d176319711fe68
parent18ca4e0e9a3f74a6f21d329882b429f8f5227b0f
Fix image uploads being random data when canvas read access is blocked (#15180)

Fixes #15178

PR #11499 introduced a way to deal with all-white canvas, but newer
Firefox versions set random data instead.

This PR detects whether canvas operations are reliable by comparing
the results on a hardcoded 2×2 pixels image, and memoizing the result.

This should be both more reliable and faster than the previous check.
app/javascript/mastodon/utils/resize_image.js