Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid security token issue - Service worker September 2019 update to spec #4805

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/backend/layouts/_head.htm
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
/* Only run on HTTPS connections
* Block off Front-end Service Worker from running in the Backend allowing security injections, see GitHub #4384
*/
if (location.protocol === 'https:') {
if ((location.protocol === 'https:') && ('serviceWorker' in navigator)) {
w20k marked this conversation as resolved.
Show resolved Hide resolved
// Unregister all service workers before signing in to prevent cache issues, see github issue: #3707
navigator.serviceWorker.getRegistrations().then(
function(registrations) {
for (let registration of registrations) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ayumi-cloud also here.

registration.unregister();
registration.unregister({ immediate: true });
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions modules/backend/layouts/auth.htm
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
/* Only run on HTTPS connections
* Block off Front-end Service Worker from running in the Backend allowing security injections, see GitHub #4384
*/
if (location.protocol === 'https:') {
if ((location.protocol === 'https:') && ('serviceWorker' in navigator)) {
// Unregister all service workers before signing in to prevent cache issues, see github issue: #3707
navigator.serviceWorker.getRegistrations().then(
function(registrations) {
for (let registration of registrations) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ayumi-cloud could you switch to ES5 style. IE11 doesn't support ES6 for ... of loop and let (credits to @tobias-kuendig for pointing out).

registration.unregister();
registration.unregister({ immediate: true });
}
}
);
Expand Down