fix: fix Firefox img.decode bug (#1357)

* fix: fix Firefox img.decode bug

Fixes #1344

* fix error
consolidate-ua-sniffing
Nolan Lawson 2019-07-23 20:33:22 -07:00 zatwierdzone przez GitHub
rodzic 1a53ad3fe4
commit fbcac6d3e4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -1,5 +1,10 @@
const IS_FIREFOX = process.browser && /Firefox/.test(navigator.userAgent)
export function decodeImage (img) {
if (typeof img.decode === 'function') {
// Remove this UA sniff when the Firefox bug is fixed
// https://github.com/nolanlawson/pinafore/issues/1344#issuecomment-514312672
// https://bugzilla.mozilla.org/show_bug.cgi?id=1565542
if (!IS_FIREFOX && typeof img.decode === 'function') {
return img.decode()
}