From 2f977ac8f342e16024206903097bde6cd01572a5 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 18 Feb 2020 17:22:44 +0100 Subject: [PATCH] [Glitch] Fix old browsers crashing because of missing `finally` polyfill in web UI Port 3cdaa347838425b65295051cea7ed9f773876178 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/util/base_polyfills.js | 3 +++ app/javascript/flavours/glitch/util/load_polyfills.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/util/base_polyfills.js b/app/javascript/flavours/glitch/util/base_polyfills.js index ad023eb73e..4b8123dba0 100644 --- a/app/javascript/flavours/glitch/util/base_polyfills.js +++ b/app/javascript/flavours/glitch/util/base_polyfills.js @@ -6,6 +6,7 @@ import assign from 'object-assign'; import values from 'object.values'; import isNaN from 'is-nan'; import { decode as decodeBase64 } from './base64'; +import promiseFinally from 'promise.prototype.finally'; if (!Array.prototype.includes) { includes.shim(); @@ -23,6 +24,8 @@ if (!Number.isNaN) { Number.isNaN = isNaN; } +promiseFinally.shim(); + if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; diff --git a/app/javascript/flavours/glitch/util/load_polyfills.js b/app/javascript/flavours/glitch/util/load_polyfills.js index 8cb81c1a61..73eedc9dcc 100644 --- a/app/javascript/flavours/glitch/util/load_polyfills.js +++ b/app/javascript/flavours/glitch/util/load_polyfills.js @@ -18,7 +18,8 @@ function loadPolyfills() { Number.isNaN && Object.assign && Object.values && - window.Symbol + window.Symbol && + Promise.prototype.finally ); // Latest version of Firefox and Safari do not have IntersectionObserver.