From 9b94332b22190ea75fbd9ab9479e7777ee83616e Mon Sep 17 00:00:00 2001 From: cbingb666 <33190523+cbingb666@users.noreply.github.com> Date: Thu, 13 Jun 2024 23:07:43 +0800 Subject: [PATCH] fix: Compatibility before chrome116 (#1034) Co-authored-by: cbingb666 --- src/background/rss.ts | 2 +- src/background/rules.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/background/rss.ts b/src/background/rss.ts index c932d221..d3736657 100644 --- a/src/background/rss.ts +++ b/src/background/rss.ts @@ -44,7 +44,7 @@ export const getRSS = async (tabId, url) => { tabId, }) - if (chrome.offscreen) { + if (chrome.offscreen && chrome.runtime.getContexts) { await setupOffscreenDocument("tabs/offscreen.html") chrome.runtime.sendMessage({ target: "offscreen", diff --git a/src/background/rules.ts b/src/background/rules.ts index c7909264..1baa8c86 100644 --- a/src/background/rules.ts +++ b/src/background/rules.ts @@ -12,7 +12,7 @@ const storage = new Storage({ export const refreshRules = async () => { const rules = await getRemoteRules() await storage.set("rules", rules) - if (chrome.offscreen) { + if (chrome.offscreen && chrome.runtime.getContexts) { await setupOffscreenDocument("tabs/offscreen.html") chrome.runtime.sendMessage({ target: "offscreen",