From 6715f91b453ec3c20a325b76fea6828923b56c31 Mon Sep 17 00:00:00 2001 From: Stefan Zerkalica Date: Tue, 5 Nov 2024 10:52:57 +0300 Subject: [PATCH] $mol_service_worker minor fixes --- offline/offline.ts | 4 ++-- service/plugin/plugin.ts | 4 ---- service/worker/worker.web.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/offline/offline.ts b/offline/offline.ts index 71e2d8aa97..e2efbefd34 100644 --- a/offline/offline.ts +++ b/offline/offline.ts @@ -33,7 +33,7 @@ namespace $ { if (cache === 'reload' || ( cache === 'no-cache' && ! html ) ) { if (cache === 'reload') { // F5 + Disable cache - request = this.request_clone(request, { cache: 'no-cache' }) + request = new ($mol_wire_sync(Request))(request, { cache: 'no-cache' }) } // fetch with fallback to cache if statuses not match @@ -49,7 +49,7 @@ namespace $ { } if (cache !== 'force-cache') { - request = this.request_clone(request, { cache: 'force-cache' }) + request = new ($mol_wire_sync(Request))(request, { cache: 'force-cache' }) } const cached = this.$.$mol_fetch.response(request) diff --git a/service/plugin/plugin.ts b/service/plugin/plugin.ts index 1428392c23..1bbb7b85f0 100644 --- a/service/plugin/plugin.ts +++ b/service/plugin/plugin.ts @@ -23,10 +23,6 @@ namespace $ { static blocked(request: Request) { return false } static need_modify(request: Request) { return false } static modify(request: Request) { return new Response } - @ $mol_action - protected static request_clone(original: Request, options?: RequestInit) { - return new Request(original, options) - } } export class $mol_service_plugin_notify extends $mol_service_plugin_base { diff --git a/service/worker/worker.web.ts b/service/worker/worker.web.ts index f14855e7b7..2b02e94295 100644 --- a/service/worker/worker.web.ts +++ b/service/worker/worker.web.ts @@ -239,7 +239,7 @@ namespace $ { return $mol_wire_async(plugin).modify(event.request) .catch(error => { - this.plugin_error(error, `${plugin}.need_modify()`) + this.plugin_error(error, `${plugin}.modify()`) throw error }) } catch (error) {