From b558f4abc59e1d026dcd023d05b0f6c1967b07ab Mon Sep 17 00:00:00 2001 From: HanYaodong Date: Sun, 25 Feb 2024 19:20:27 +0800 Subject: [PATCH] Remove offscreen doc, turns out it doesn't matter --- manifest/manifest.json | 3 +-- public/offscreen.html | 7 ------- src/background.ts | 17 ----------------- src/offscreen.ts | 1 - webpack/webpack.common.js | 1 - 5 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 public/offscreen.html delete mode 100644 src/offscreen.ts diff --git a/manifest/manifest.json b/manifest/manifest.json index b3fd01a8..bcdcb54e 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -85,8 +85,7 @@ ], "permissions": [ "storage", - "scripting", - "offscreen" + "scripting" ], "host_permissions": [ "https://*.bilibili.com/*" diff --git a/public/offscreen.html b/public/offscreen.html deleted file mode 100644 index 971294a3..00000000 --- a/public/offscreen.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - BiliSponsorBlockOffscreen - - - diff --git a/src/background.ts b/src/background.ts index 328e7bf9..a2d61770 100644 --- a/src/background.ts +++ b/src/background.ts @@ -28,7 +28,6 @@ utils.wait(() => Config.isReady()).then(function() { setupBackgroundRequestProxy(); setupTabUpdates(Config); -setupOffscreenDocument(); chrome.runtime.onMessage.addListener(function (request, sender, callback) { switch(request.message) { @@ -243,19 +242,3 @@ async function asyncRequestToServer(type: string, address: string, data = {}) { return await (sendRealRequestToCustomServer(type, serverAddress + address, data)); } - -async function setupOffscreenDocument() { - const offscreenUrl = chrome.runtime.getURL('offscreen.html'); - - const existingContexts = await chrome.runtime.getContexts({ - contextTypes: [chrome.runtime.ContextType.OFFSCREEN_DOCUMENT], - documentUrls: [offscreenUrl] - }); - if (existingContexts.length > 0) return; - - await chrome.offscreen.createDocument({ - url: chrome.runtime.getURL(offscreenUrl), - reasons: [chrome.offscreen.Reason.WORKERS, chrome.offscreen.Reason.LOCAL_STORAGE], - justification: 'Worker for Bilibili Sponsor Block', - }); -} diff --git a/src/offscreen.ts b/src/offscreen.ts deleted file mode 100644 index 4afe2d8c..00000000 --- a/src/offscreen.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("offscreen.ts loaded"); diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index 6b05abdf..f9366627 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -95,7 +95,6 @@ module.exports = env => { entry: { popup: path.join(__dirname, srcDir + 'popup.ts'), background: path.join(__dirname, srcDir + 'background.ts'), - offscreen: path.join(__dirname, srcDir + 'offscreen.ts'), content: path.join(__dirname, srcDir + 'content.ts'), options: path.join(__dirname, srcDir + 'options.ts'), help: path.join(__dirname, srcDir + 'help.ts'),