Proxy filtering requests per window/tab

Requests originated in our product are opened in a special window. We’re using a custom made add-on to intercept such requests and send them to our proxy which handles them further.

We are using nsIProtocolProxyService, but we’ve stumbled upon unresolveable issue, as far as we can see it at the moment. In applyFilter function, we do not have enough information about request origin so we can distinguish our requests from the others.

We would like to know if there a possibility to get window object inside of nsIProtocolProxyService, or if we can get it on any layer below or above, so we can properly differentiate between the requests and send only ours to the proxy. Or, alternatively, if it is possible to change request somewhere in nsIProtocolProxyService or after, specifically GET parameters, without redirection and repeating the whole request cycle again. Or if we can access the headers… Or anything that can help us mark our request, or recognize it in some way inside nsIProtocolProxyService, without affecting its validity.

Any ideas? Thanks a lot.

1 Like

So you’re saying that the URL isn’t enough to distinguish the requests from your product, right? You want to tell if they come from a specific window or tab?

If that’s the case, one not-so-elegant solution would be to use the Window Mediator component to iterate over the open windows to check if the request corresponds to what you want.

A proxy per tab? I’ve seen this subject come up multiple times but I have never seen a solution.

Here are places I saw it: