Removed CSP checks in service worker
This commit is contained in:
parent
0b6b161a37
commit
47a6b1b60c
@ -38,11 +38,9 @@ class MyCache {
|
|||||||
|
|
||||||
class MyServiceWorker {
|
class MyServiceWorker {
|
||||||
cache: MyCache
|
cache: MyCache
|
||||||
currentCSP: string
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.cache = new MyCache("v-5")
|
this.cache = new MyCache("v-5")
|
||||||
this.currentCSP = ""
|
|
||||||
|
|
||||||
self.addEventListener("install", (evt: InstallEvent) => evt.waitUntil(this.onInstall(evt)))
|
self.addEventListener("install", (evt: InstallEvent) => evt.waitUntil(this.onInstall(evt)))
|
||||||
self.addEventListener("activate", (evt: any) => evt.waitUntil(this.onActivate(evt)))
|
self.addEventListener("activate", (evt: any) => evt.waitUntil(this.onActivate(evt)))
|
||||||
@ -185,19 +183,6 @@ class MyServiceWorker {
|
|||||||
// Update ETag
|
// Update ETag
|
||||||
ETAGS.set(url, eTag)
|
ETAGS.set(url, eTag)
|
||||||
|
|
||||||
// Get CSP
|
|
||||||
let oldCSP = this.currentCSP
|
|
||||||
let csp = response.headers.get("Content-Security-Policy")
|
|
||||||
|
|
||||||
// If the CSP and therefore the sha-1 hash of the CSS changed, we need to do a reload.
|
|
||||||
if(csp != oldCSP) {
|
|
||||||
this.currentCSP = csp
|
|
||||||
|
|
||||||
if(oldCSP !== "") {
|
|
||||||
return this.forceClientReloadPage(url, evt.source)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the ETag changed, we need to do a reload.
|
// If the ETag changed, we need to do a reload.
|
||||||
if(eTag !== servedETag) {
|
if(eTag !== servedETag) {
|
||||||
return this.forceClientReloadContent(url, evt.source)
|
return this.forceClientReloadContent(url, evt.source)
|
||||||
|
Loading…
Reference in New Issue
Block a user