diff --git a/src/browser/setupWorker/glossary.ts b/src/browser/setupWorker/glossary.ts index ff1540622..23017c6ec 100644 --- a/src/browser/setupWorker/glossary.ts +++ b/src/browser/setupWorker/glossary.ts @@ -146,8 +146,8 @@ export interface SetupWorkerInternalContext { ServiceWorkerMessage > } - useFallbackMode: boolean supports: { + serviceWorkerApi: boolean readableStreamTransfer: boolean } fallbackInterceptor?: Interceptor diff --git a/src/browser/setupWorker/setupWorker.ts b/src/browser/setupWorker/setupWorker.ts index 39bb42448..b89376641 100644 --- a/src/browser/setupWorker/setupWorker.ts +++ b/src/browser/setupWorker/setupWorker.ts @@ -143,9 +143,9 @@ export class SetupWorkerApi }) }, }, - useFallbackMode: - !('serviceWorker' in navigator) || location.protocol === 'file:', supports: { + serviceWorkerApi: + !('serviceWorker' in navigator) || location.protocol === 'file:', readableStreamTransfer: supportsReadableStreamTransfer(), }, } @@ -160,11 +160,11 @@ export class SetupWorkerApi }, }) - this.startHandler = context.useFallbackMode + this.startHandler = context.supports.serviceWorkerApi ? createFallbackStart(context) : createStartHandler(context) - this.stopHandler = context.useFallbackMode + this.stopHandler = context.supports.serviceWorkerApi ? createFallbackStop(context) : createStop(context)