I am working on manifest version 3 and stuck in an endless loophole for getting the response body by requested API in the chrome extension.
Goal is to have all requested API response
here's the code.
manifest.json
{
"name": "Chapter 28 (MV3)",
"version": "1.0",
"manifest_version": 3,
"description": "This is Chapter 28",
"declarative_net_request" : {
"rule_resources" : [{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}]
},
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback"
],
"background": {
"service_worker": "background.js"
}
}
rules_1.json
[
{
"id": 1,
"priority": 1,
"action": {
"type": "block"
},
"condition": {
"urlFilter": "yahoo.co.jp",
"resourceTypes": ["main_frame"]
}
},
{
"id": 2,
"priority": 1,
"action": {
"type": "allow"
},
"condition": {
"resourceTypes": ["main_frame", "xmlhttprequest"]
}
}
]
background.js
chrome.declarativeNetRequest.onRuleMatchedDebug.addListener((mrd) => {
console.log(mrd)
});