From 6e64e505f9bc4f720c024afcd77e96e999f81196 Mon Sep 17 00:00:00 2001 From: murdle Date: Sun, 21 Dec 2025 00:05:29 +0200 Subject: [PATCH] more firefox 52 fixes --- assets/public/custom/pushMessages.js | 16 ++++++++-------- assets/public/custom/web/main.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/public/custom/pushMessages.js b/assets/public/custom/pushMessages.js index 4a76100f..e5c66f0b 100644 --- a/assets/public/custom/pushMessages.js +++ b/assets/public/custom/pushMessages.js @@ -24,15 +24,15 @@ async function unregisterPush() { checkServiceWorkerSupport(); try { const registrations = await navigator.serviceWorker.getRegistrations(); - if (!registrations?.length) return; + if (!registrations || registrations.length === 0) return; - await Promise.all( - registrations.map(async (reg) => { - const sub = await reg.pushManager.getSubscription(); - if (sub) await sub.unsubscribe(); - await reg.unregister(); - }) - ); + for (let i = 0; i < registrations.length; i++) { + const reg = registrations[i]; + const sub = await reg.pushManager.getSubscription(); + + if (sub) await sub.unsubscribe(); + await reg.unregister(); + } } catch (err) { console.error("Failed to unregister push:", err); } diff --git a/assets/public/custom/web/main.js b/assets/public/custom/web/main.js index c182d085..68a1a4e7 100644 --- a/assets/public/custom/web/main.js +++ b/assets/public/custom/web/main.js @@ -99,7 +99,7 @@ try { await (checked ? registerPush(publicKey) : unregisterPush()); return true; - } catch { + } catch(error) { return false; } }