Q:

How can I capture specific xmlhttprequests in Firefox extension? 

I'm writing a firefox extension and want to capture the requests being sent out to a certain url.  
I'm adding a listener to the event, browser.webRequest.onCompleted from a background script.  Problem is that the listener only gets fired up if I add <all_urls> in the permissions section of the manifest and the urls option in the filter when adding the listener. 
src/background.js:
function saveData(result) {
    console.log(result);
}

browser.webRequest.onCompleted.addListener(
    saveData,
    {
        urls: ["<all_urls>"],
        types: ['xmlhttprequest']
    });

Manifest.json:
{
    "manifest_version": 2,
    "name": "LolEsports Extension",
    "version": "1.0.0",

    "permissions": [
        "<all_urls>",
        "webRequest",
        "webRequestBlocking",
        "storage"
    ],

    "background": {
        "scripts": ["src/background.js"]
    }
}

Here's what I get:

But if I change the manifest to:
"permissions": [
     "https://prod-relapi.ewp.gg/persisted/gw/*",
     "webRequest",
     "webRequestBlocking",
     "storage"
 ]

and in background.js:
browser.webRequest.onCompleted.addListener(
    saveData,
    {
        urls: ["https://prod-relapi.ewp.gg/persisted/gw/*"],
        types: ['xmlhttprequest']
    });

nothing is shown in the console.  What am I missing so that the listener is fired up on specific url patterns?? 

A:

Quoting MDN:

To intercept resources loaded by a page (such as images, scripts, or stylesheets), the extension must have the host permission for the resource as well as for the main page requesting the resource.  For example, if a page at "https://developer.mozilla.org" loads an image from "https://mdn.mozillademos.org", then an extension must have both host permissions if it is to intercept the image request. 

Quoting Chrome API documentation:

Starting from Chrome 72, an extension will be able to intercept a request only if it has host permissions to both the requested URL and the request initiator. 

So you need to add "https://watch.euw.lolesports.com/*" in manifest's "permissions".