Skip to content

Fix image uploads being random data when canvas read access is blocked#15180

Merged
Gargron merged 1 commit intomastodon:masterfrom
ClearlyClaire:fixes/detect-unreliable-canvas
Nov 18, 2020
Merged

Fix image uploads being random data when canvas read access is blocked#15180
Gargron merged 1 commit intomastodon:masterfrom
ClearlyClaire:fixes/detect-unreliable-canvas

Conversation

@ClearlyClaire
Copy link
Copy Markdown
Contributor

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.

Fixes mastodon#15178

PR mastodon#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.
@Gargron Gargron merged commit d8d43a4 into mastodon:master Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uploading images result in a colored background

2 participants