From 1fdb0593b532d75d1b48fca39c6fee4da0bef7a1 Mon Sep 17 00:00:00 2001 From: Thomas Espach Date: Tue, 30 Jul 2024 16:15:27 +0100 Subject: [PATCH] Fix indentation and quotations --- security/badware/service-worker.js | 73 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/security/badware/service-worker.js b/security/badware/service-worker.js index 783fc34..52612f8 100644 --- a/security/badware/service-worker.js +++ b/security/badware/service-worker.js @@ -1,44 +1,43 @@ -self.addEventListener("install", (event) => { - console.log("Service Worker installing."); - self.skipWaiting(); +self.addEventListener('install', () => { + console.log('Service Worker installing.'); + self.skipWaiting(); }); -self.addEventListener("activate", (event) => { - console.log("Service Worker activating."); - event.waitUntil(self.clients.claim()); +self.addEventListener('activate', () => { + console.log('Service Worker activating.'); + self.clients.claim(); }); -self.addEventListener("message", (event) => { - if (event.data === "navigate") { - console.log("Service Worker received navigate message."); - self.clients.matchAll({ type: "window" }).then((clients) => { - clients.forEach((client) => { - if ("navigate" in client) { - client - .navigate("/security/badware/phishing.html") - .then(() => { - console.log("Navigation attempt to phishing page."); +self.addEventListener('message', (event) => { + if (event.data === 'navigate') { + console.log('Service Worker received navigate message.'); + self.clients.matchAll({ type: 'window' }).then((clients) => { + clients.forEach((client) => { + if ('navigate' in client) { + client.navigate('/security/badware/phishing.html') + .then(() => { + console.log('Navigation attempt to phishing page.'); + }) + .catch((error) => { + console.error('Navigation failed:', error); + }); + } + }); + }); + } else if (event.data === 'fetch') { + console.log('Service Worker received fetch message.'); + fetch('https://bad.third-party.site/security/badware/phishing.html') + .then((response) => { + if (response.ok) { + console.log('Phishing page fetched successfully.'); + } else { + console.log('Failed to fetch phishing page.'); + } }) .catch((error) => { - console.error("Navigation failed:", error); + console.error('Error fetching phishing page:', error); }); - } - }); - }); - } else if (event.data === "fetch") { - console.log("Service Worker received fetch message."); - fetch("https://bad.third-party.site/security/badware/phishing.html") - .then((response) => { - if (response.ok) { - console.log("Phishing page fetched successfully."); - } else { - console.log("Failed to fetch phishing page."); - } - }) - .catch((error) => { - console.error("Error fetching phishing page:", error); - }); - } else { - console.log("Service Worker received unknown message:", event.data); - } -}); \ No newline at end of file + } else { + console.log('Service Worker received unknown message:', event.data); + } +});