This commit is contained in:
cilame 2021-10-17 17:28:06 +08:00
parent 83151df98e
commit 7c585a3a32

View File

@ -50,14 +50,13 @@ chrome.debugger.onDetach.addListener(function(){
attached = false attached = false
}) })
var attached = false var attached = false
var currtab;
function AttachDebugger() { function AttachDebugger() {
if (attached){ return } if (attached){ return }
attached = true attached = true
chrome.tabs.query( chrome.tabs.query(
{ active: true, currentWindow: true }, { active: true, currentWindow: true },
function (tabs) { function (tabs) {
currtab = { tabId: tabs[0].id }; var currtab = { tabId: tabs[0].id };
chrome.debugger.attach(currtab, "1.2", function () { chrome.debugger.attach(currtab, "1.2", function () {
// Document, Stylesheet, Image, Media, Font, Script, TextTrack, XHR, Fetch, EventSource, WebSocket, Manifest, SignedExchange, Ping, CSPViolationReport, Preflight, Other // Document, Stylesheet, Image, Media, Font, Script, TextTrack, XHR, Fetch, EventSource, WebSocket, Manifest, SignedExchange, Ping, CSPViolationReport, Preflight, Other
sendCommand("Network.enable", {}, currtab, function(){ sendCommand("Network.setCacheDisabled", {cacheDisabled: true}, currtab)} ) // 确保 Fetch.getResponseBody 一定能收到东西 sendCommand("Network.enable", {}, currtab, function(){ sendCommand("Network.setCacheDisabled", {cacheDisabled: true}, currtab)} ) // 确保 Fetch.getResponseBody 一定能收到东西