mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 17:22:46 +08:00
FIX: Remove all service workers from Apple devices *again*
There is a bug that when Safari starts up, and reloads the tabs from the previous session **and** there is a service worker registered for the scope of the document, all cookies marked as `SameSite=Lax` won't be sent in the request. This puts Discourse in a **very** broken state, where: - You appear as a anon user - Subsequent xhr requests will come with logged in data - Refreshing doesn't log you in (cookies are still not sent) - Clicking on the address bar and hitting enter, will log you in (as it will finally send those damn `SameSite=Lax` cookies. Looks a lot like a corner case missed by the fix at https://trac.webkit.org/changeset/241918/webkit
This commit is contained in:
parent
a571efba35
commit
2a0cd066a7
|
@ -9,7 +9,9 @@ export default {
|
|||
const isSupported = isSecured && "serviceWorker" in navigator;
|
||||
|
||||
if (isSupported) {
|
||||
if (Discourse.ServiceWorkerURL) {
|
||||
const isApple = !!navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i);
|
||||
|
||||
if (Discourse.ServiceWorkerURL && !isApple) {
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
for (let registration of registrations) {
|
||||
if (
|
||||
|
|
Loading…
Reference in New Issue
Block a user