Skip to content

Commit

Permalink
Remove offscreen doc, turns out it doesn't matter
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Feb 25, 2024
1 parent 1513c58 commit b558f4a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 28 deletions.
3 changes: 1 addition & 2 deletions manifest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
],
"permissions": [
"storage",
"scripting",
"offscreen"
"scripting"
],
"host_permissions": [
"https://*.bilibili.com/*"
Expand Down
7 changes: 0 additions & 7 deletions public/offscreen.html

This file was deleted.

17 changes: 0 additions & 17 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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',
});
}
1 change: 0 additions & 1 deletion src/offscreen.ts

This file was deleted.

1 change: 0 additions & 1 deletion webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit b558f4a

Please sign in to comment.