Removed CSP checks in service worker

This commit is contained in:
Eduard Urbach 2017-11-28 23:06:05 +01:00
parent 0b6b161a37
commit 47a6b1b60c

View File

@ -38,11 +38,9 @@ class MyCache {
class MyServiceWorker {
cache: MyCache
currentCSP: string
constructor() {
this.cache = new MyCache("v-5")
this.currentCSP = ""
self.addEventListener("install", (evt: InstallEvent) => evt.waitUntil(this.onInstall(evt)))
self.addEventListener("activate", (evt: any) => evt.waitUntil(this.onActivate(evt)))
@ -185,19 +183,6 @@ class MyServiceWorker {
// Update 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(eTag !== servedETag) {
return this.forceClientReloadContent(url, evt.source)