From 4743fa6e70ca35ab9ee306671dc2385f128977cb Mon Sep 17 00:00:00 2001 From: cilame Date: Sat, 16 Oct 2021 18:47:22 +0800 Subject: [PATCH] add --- background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 9333407..a1501d5 100644 --- a/background.js +++ b/background.js @@ -55,7 +55,10 @@ chrome.debugger.onEvent.addListener(function (source, method, params){ } } }) -var attached = false; +chrome.debugger.onDetach.addListener(function(){ + attached = false +}) +var attached = false function AttachDebugger() { if (attached){ return } attached = true @@ -64,7 +67,6 @@ function AttachDebugger() { function (tabs) { var tab = { tabId: tabs[0].id }; chrome.debugger.attach(tab, "1.2", function () { - console.log('attached debugger.') sendCommand("Fetch.enable", { patterns: [ {urlPattern:"*",resourceType:"Script",requestStage:"Response"} // 监听类型,目前主要监听 Script ] }, tab);