I am working on chrome extension where I have a requirement to intercept and block certain XHR requestes that are originating inside iframe. I tried below code, but its intercepting only top frame requests
chrome.webRequest.onBeforeRequest.addListener(
() => {
console.log('Request will be blocked here, if request is interceped');
return {cancel: true}
},
{ urls: ['*://*/*'], types: ['main_frame','sub_frame']},
['blocking']
);