mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-14 11:45:58 +08:00
add
This commit is contained in:
parent
210ece56d9
commit
e9b11044cd
@ -17,7 +17,7 @@ chrome.contextMenus.create({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
function sendCommand(method, params, source, chainfun){
|
function sendCommand(method, params, source, chainfun){
|
||||||
chrome.debugger.sendCommand(source, method, params, result => {
|
chrome.debugger.sendCommand(source, method, params, function(result){
|
||||||
if (chrome.runtime.lastError) {
|
if (chrome.runtime.lastError) {
|
||||||
console.error('chrome.runtime.lastError', chrome.runtime.lastError)
|
console.error('chrome.runtime.lastError', chrome.runtime.lastError)
|
||||||
} else {
|
} else {
|
||||||
@ -32,7 +32,7 @@ chrome.debugger.onEvent.addListener(function (source, method, params){
|
|||||||
case "Fetch.requestPaused":
|
case "Fetch.requestPaused":
|
||||||
console.log("xmFetch","Fetch.requestPaused", params.request.url)
|
console.log("xmFetch","Fetch.requestPaused", params.request.url)
|
||||||
var itheaders = params.responseHeaders;
|
var itheaders = params.responseHeaders;
|
||||||
if (itheaders.find(v => v.name == "Location")) {
|
if (itheaders.find(function(v){return v.name == "Location"})) {
|
||||||
sendCommand("Fetch.continueRequest", { requestId: params.requestId, url: itheaders.value }, source);
|
sendCommand("Fetch.continueRequest", { requestId: params.requestId, url: itheaders.value }, source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,9 @@ chrome.debugger.onEvent.addListener(function (source, method, params){
|
|||||||
}
|
}
|
||||||
sendCommand("Fetch.getResponseBody", { requestId: params.requestId }, source, function(result){
|
sendCommand("Fetch.getResponseBody", { requestId: params.requestId }, source, function(result){
|
||||||
if (result.body !== undefined){
|
if (result.body !== undefined){
|
||||||
var rescode = atob(result.body) // 收到的是 base64 的代码,base64 解一下就是原始代码,对这个代码处理一下后续再传入 body
|
// 收到的是 base64 的代码,base64 解一下就是原始代码,对这个代码处理一下后续再用 base64 包一层再传入 body
|
||||||
|
// 注意,这里需要你指定一下 Disable cache 。否则可能收不到代码字符串。
|
||||||
|
var rescode = atob(result.body)
|
||||||
console.log(rescode)
|
console.log(rescode)
|
||||||
}
|
}
|
||||||
sendCommand("Fetch.fulfillRequest", {
|
sendCommand("Fetch.fulfillRequest", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user