From 0167aecfe7551cb75a4c0a96e4a9ac2a6a9e62c0 Mon Sep 17 00:00:00 2001 From: cilame Date: Sun, 17 Oct 2021 14:13:46 +0800 Subject: [PATCH] add --- background.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 870d75b..38b4fac 100644 --- a/background.js +++ b/background.js @@ -34,7 +34,6 @@ chrome.debugger.onEvent.addListener(function (source, method, params){ sendCommand("Fetch.getResponseBody", { requestId: params.requestId }, source, function(result){ if (result.body !== undefined){ // 收到的是 base64 的代码,base64 解一下就是原始代码,对这个代码处理一下后续再用 base64 包一层再传入 body - // 注意,这里需要你指定一下 Disable cache 。否则可能收不到代码字符串。 var rescode = atob(result.body) console.log(rescode) } @@ -59,8 +58,10 @@ function AttachDebugger() { function (tabs) { var tab = { tabId: tabs[0].id }; chrome.debugger.attach(tab, "1.2", function () { + // Document, Stylesheet, Image, Media, Font, Script, TextTrack, XHR, Fetch, EventSource, WebSocket, Manifest, SignedExchange, Ping, CSPViolationReport, Preflight, Other sendCommand("Fetch.enable", { patterns: [ - {urlPattern:"*",resourceType:"Script",requestStage:"Response"} // 监听类型,目前主要监听 Script + {urlPattern:"*",resourceType:"Script",requestStage:"Response"}, + {urlPattern:"*",resourceType:"Document",requestStage:"Response"}, ] }, tab); }); }