From 4c2ff0d1aeeb5fdecf27dce90af0a3503fd61246 Mon Sep 17 00:00:00 2001 From: z0ccc Date: Mon, 30 Jan 2023 02:14:49 -0500 Subject: [PATCH] Switch back attachTab method temporarily (to avoid warning) --- src/background/index.ts | 20 +++++++++++++++----- src/manifest.json | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/background/index.ts b/src/background/index.ts index a66e4a0..e3d6f73 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -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) +}) diff --git a/src/manifest.json b/src/manifest.json index c8c6ec2..84d1f68 100755 --- a/src/manifest.json +++ b/src/manifest.json @@ -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",