Switch back attachTab method temporarily (to avoid warning)

This commit is contained in:
z0ccc 2023-01-30 02:14:49 -05:00
parent 10dc61fcdc
commit 4c2ff0d1ae
2 changed files with 16 additions and 6 deletions

View file

@ -1,12 +1,22 @@
import attachDebugger from '../utils/attachDebugger'
import attachDebugger from './attachDebugger'
const attachTab = (e: any) => {
const attachTab = (tabId: number) => {
chrome.debugger.getTargets((tabs) => {
const currentTab = tabs.find((obj) => obj.tabId === e.tabId)
const currentTab = tabs.find((obj) => obj.tabId === tabId)
if (!currentTab?.attached) {
attachDebugger(e.tabId)
attachDebugger(tabId)
}
})
}
chrome.webNavigation.onBeforeNavigate.addListener(attachTab)
chrome.tabs.onCreated.addListener((tab) => {
tab.id && attachDebugger(tab.id)
})
chrome.tabs.onActivated.addListener((tab) => {
attachTab(tab.tabId)
})
chrome.tabs.onUpdated.addListener((tabId) => {
attachTab(tabId)
})

View file

@ -5,7 +5,7 @@
"description": "__MSG_extDesc__",
"author": "__MSG_extName__",
"default_locale": "en",
"permissions": ["storage", "debugger", "webNavigation"],
"permissions": ["storage", "debugger"],
"background": { "service_worker": "background.bundle.js" },
"action": {
"default_popup": "popup.html",