Closed Bug 1368559 Opened 5 years ago Closed 5 years ago

Provide contextual info to FindProxyForURL


(WebExtensions :: Request Handling, defect, P2)



(Not tracked)



(Reporter: mattw, Assigned: mixedpuppy)


(Blocks 1 open bug)


(Whiteboard: [proxy] triaged)

The following information should be provided to FindProxyForURL:

 - tabID {integer} the current tab ID for the page loaded.
 - isPrivateMode {boolean} whether or not the window is in private browsing mode.
 - windowID {integer} the ID of the current browser window.
 - userContextID {integer} the user context ID for the tab's container.

For more information, see the proxy API design document:
Priority: -- → P1
Need to document some use cases for new data, lets make sure they will be useful.  So, I'll start with a couple:

with isPrivateMode a PAC may
- choose to let all private windows go direct
- use a specific proxy for private browsing

with userContextID a PAC may
- proxy "work" through a different server than "banking"

I'm failing to come up with a simple use case for tabID or windowID given these IDs will have no value in the PAC script without adding more WE APIs to it.

Since this is now a P1 bug, it seems there should be better definition for what is needed and useful.
Changing to P2 since much of this info wasn't available prior to WebExtensions.

> I'm failing to come up with a simple use case for tabID or windowID
A long-requested feature from proxy addons has been "proxy-per-tab" or "proxy-per-window". In other words, use proxy A for this tab and proxy B for another tab.

I think some of this contextual info is available by using nsIProtocolProxyService.registerChannelFilter() instead of nsIProtocolProxyService.registerFilter() as we are currently doing in ProxyScriptContext.jsm. registerChannelFilter() hands you an nsIChannel instance which, IIRC, can be used to get tab or window data (load groups?)
Priority: P1 → P2
> registerChannelFilter() hands you an nsIChannel instance
through the applyFilter() callback. I opened a bug for it 9 years ago (bug 436344), and it was done 3 years ago. I never got around to using it but I know Tor Browser does.
> I'm failing to come up with a simple use case for tabID or windowID 
In addition to Eric's response, another use case would be `proxy per triggered origin` which in simple words would allow the extension to enable proxy for certain domains and all its resources that are called from it.
(Is origin url is extractable from tabID?)

This is highly is required for an extension that I'm working on right now.
Assignee: nobody → mixedpuppy
If this is possible in bug 1409878 we'll try to add it.
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1409878
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.