diff --git a/CHANGELOG.md b/CHANGELOG.md index b179a57243..5c9233b6fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -333,7 +333,9 @@ Recap: Mastodon v4.3 features (https://github.com/mastodon/mastodon/releases/tag - 🙈 Handle Mastodon's upcoming `blur` filter https://mastodon.social/@cheeaun/114301571477875063 - 🐛 Bug fixes -## Next +## June 8, 2025 + +📢 https://mastodon.social/@cheeaun/114647753143423772 - 🌟 Featured profiles (for upcoming Mastodon v4.4) - 🔑 Revoke access token when logging out diff --git a/src/polyfills.js b/src/polyfills.js index 514dad86bc..83ed700733 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -11,6 +11,36 @@ if ('AbortSignal' in window) { }); } +// AbortSignal.any polyfill +// Based on https://github.com/mozilla/pdf.js/pull/19681/files +if ('AbortSignal' in window && !AbortSignal.any) { + AbortSignal.any = function (iterable) { + const ac = new AbortController(); + const { signal } = ac; + + // Return immediately if any of the signals are already aborted. + for (const s of iterable) { + if (s.aborted) { + ac.abort(s.reason); + return signal; + } + } + + // Register "abort" listeners for all signals. + for (const s of iterable) { + s.addEventListener( + 'abort', + () => { + ac.abort(s.reason); + }, + { signal }, // Automatically remove the listener. + ); + } + + return signal; + }; +} + // URL.parse() polyfill if ('URL' in window && typeof URL.parse !== 'function') { URL.parse = function (url, base) {