From a54565ecd029094f5f4ca6900d8785c832ea5ce1 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 11 Sep 2023 08:40:00 -0400 Subject: [PATCH] fix: add service worker to check --- src/kernel/queries.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kernel/queries.ts b/src/kernel/queries.ts index bf03edb..b5fd845 100644 --- a/src/kernel/queries.ts +++ b/src/kernel/queries.ts @@ -121,6 +121,8 @@ function handleMessage(event: MessageEvent) { event.origin === EXTENSION_KERNEL_ORIGIN && IS_EXTENSION_ANY; + const FROM_SW = event.source === serviceWorker; + const FROM_HOSTED_KERNEL = event.source !== window && event.origin === EXTENSION_HOSTED_ORIGIN; @@ -130,7 +132,7 @@ function handleMessage(event: MessageEvent) { event.data = Object.assign({}, event); } - if (!FROM_KERNEL && !FROM_HOSTED_KERNEL && !bgConn) { + if (!FROM_KERNEL && !FROM_HOSTED_KERNEL && !bgConn && !FROM_SW) { return; }