Skip to content

Commit

Permalink
Switch back attachTab method temporarily (to avoid warning)
Browse files Browse the repository at this point in the history
  • Loading branch information
z0ccc committed Jan 30, 2023
1 parent 10dc61f commit 4c2ff0d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions src/background/index.ts
Original file line number Diff line number Diff line change
@@ -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)
})
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4c2ff0d

Please sign in to comment.