Thus spake Eric H. Jung (eric.jung@xxxxxxxxx): > FoxyProxy > "[...] So far the author has expressed no interest in implementing [proxy-per-tab] ability." > > This statement is patently false. I have repeatedly gone on record > as saying "proxy-per-tab" is a goal of FoxyProxy. I've made this at > irc.mozilla.org (#extdev and various other channels), the FoxyProxy > forums (http://z9.invisionfree.com/foxyproxy), and even show it as a > goal for version 2.8 at the FoxyProxy proxy road map at > http://foxyproxy.mozdev.org/roadmap.html. My apologies. The statement has been corrected. > I would have added this feature a very long time ago if I knew *how* > to do it. Unfortunately, it's unlikely to happen even for 2.8 (as > shown in the road map) because I'm no closer to getting it to work > than I was a year ago... even after much research. > > If you have any pointers on how to achieve proxy-per-tab, I'd be > grateful to hear them. I've asked in mozilla.dev.extensions, > mozilla.dev.tech.network, IRC, as well as some prominent Firefox and > SeaMonkey developers (Christian Biesinger, Benjamin Smedberg, Philip > Chee, Michael Vincent Van Rantwijk, etc.) Christian Biesinger and > Michael Vincent Van Rantwijk had some ideas which eventually panned > out. Yeah, unfortunately despite Mozilla's impressively extensive work making almost every browser behavior into scriptable, contractable components, most Firefox APIs suffer from a particularly annoying aspect of braindamage: They almost never provide the context of the browser window, tab, and/or DOMWindow that they are happening in. As I'm sure you're aware, you have to bend over backwards in all sorts of weird ways to get this sort of info without falling prey to various race conditions and window focus issues (for example, almost all of the mozilla documentation gives example code to get the currently FOCUSED navigator window, calling it the "most recent window", but this is not the actual one that just performed whatever network IO or action caused your API hook/callback to be called).. My guess is your problems arise from this issue being the case with nsIProtocolProxyFilter, right? My suggestion would be recording this context from somewhere that recieves the event first and making a cache. Torbutton does this with its content-window-mapper: https://tor-svn.freehaven.net/svn/torbutton/trunk/src/components/window-mapper.js That component may be helpful for you to use as a starting point to map DOMWindows to tabbrowsers, but you probably need another layer for URLs themselves. Probably you want to go with a dummy nsIContentPolicy that gets the window for a URL fetch (see https://tor-svn.freehaven.net/svn/torbutton/trunk/src/components/cssblocker.js for how torbutton does this), then use the torbutton window mapper to map this to a tabbrowser, then use your own custom component to map that URL to that tabbrowser.. If you are real lucky, your nsIContentPolicy will always be called before your nsIProtocolProxyFilter, and thus your URL->tabbrowser mapper will always have the correct (and most recent/current) tabbrowser, which you would then use to look up the appropriate proxy in your filter based on the tabbrowser's contentWindow.top.location URL instead of the one handed to nsIProtocolProxyFilter.applyFilter. If you are no so lucky wrt to the ordering of those two interface calls, perhaps the doc loader service can provide you with similar context information that you can cache, but its unclear if this will give you ALL url evens like the content policy will: http://www.xulplanet.com/references/xpcomref/comps/c_docloaderservice1.html > At the least, I'd appreciate if Scott and Mike change the torbutton > webpage. Moreover, I welcome you to contribute to FoxyProxy and/or > help me solve the proxy-per-tab difficulties. The page has been updated. Again, sorry for spreading any misinformation. I hope we can work together to provide users with as many secure and easy to use privacy-enhancing options as possible. Please feel free to borrow any Torbutton source code to help improve FoxyProxy. I will be posting a design document within a week or so that should help you more easily navigate all the crazy hacks I have done to deal with the various idiosyncrasies of Firefox component behavior and context wrt privacy and safe Tor usage. -- Mike Perry Mad Computer Scientist fscked.org evil labs
Attachment:
pgphHjXU2mzXT.pgp
Description: PGP signature