-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
763431c
commit 1fdb059
Showing
1 changed file
with
36 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
}); | ||
} else { | ||
console.log('Service Worker received unknown message:', event.data); | ||
} | ||
}); |