Multiple Cookie Containers for Firefox

A few weeks ago I began work on modifying the cookie system on Firefox to support multiple “containers”. Multiple Containers enables users to log in to many websites as multiple users on the same Firefox session. It is very useful for web developers who require this functionality to test their user account systems. Another use is for people who have multiple web mail accounts with the same provider that they want simultaneously logged on to. This is an oft-requested feature that Internet Explorer partially supports. (See bug #117222)

I’m happy to say that this is now ready for testing. Below is a working build for Windows. It is based on the latest Trunk plus the cookie patch and extension. Unfortunately for Mac and Linux users that wish to try the patch, they will have to manually compile Firefox with the patch below.


Note that this build is meant for users who are familiar with using Firefox test builds and not intended for production. You are recommended to create a new profile. If you intend to use an existing Firefox Trunk profile on the cookie patched Firefox, the only caveat is that your old session store (windows and tabs saving) cookies will not be restored (but long term cookies will be there). Similarly when transitioning back from the patched Firefox to normal Firefox, you will lose the session cookies, but also will be unable to access cookies saved in containers other than Jar A.

In the patched Firefox, to use the new container, or “jars”, just click on the jar icon in the far right of the status bar. The letter represents the current selected jar for this tab. You can assign a different jar letters to each tab. Cookies from all accessed pages will be deposited in this jar. If you open a link in a new window/tab, the jar letter should carry forward to the next window/tab.

All long term cookies are saved in the Firefox profile folder. Jar A will be saved as cookies.txt and compatible with older Firefox. Jar B will be saved as cookies_B.txt and Jar C cookies_C.txt

There is a known issue in which if you have the cookie manager open while browsing, it will incorrectly show cookies listed. This is just a GUI issue and doesn’t affect the core functionality.

Compiled Firefox for Windows

To compile with the patch yourself, download and apply the patch the trunk (made against 13-May-2007). In the compiled result dist/bin extract cookiejarschrome.zip into the chrome subfolder.

Patch for trunk source
cookiejarschrome.zip

Edit: Fixed links

5 thoughts on “Multiple Cookie Containers for Firefox

  1. Monkey

    Just a few words of encouragement: I like your overall design for this feature, at least from an end-user perspective, I am not familiar enough with mozilla code to comment on the source-level changes.

    The “jars” UI for this patch made me think of a related feature that I have been longing for and this patch might make it possible.

    Could there be any way to direct long-term cookies into a jar as well as the session cookies? I think it would be nice to have a tab open for general browsing that would either a) not save cookies or b) save them in a location that could be cleared separately from my regular browser cookies, such as a separate “jar.”

    The purpose would be for tidiness and privacy – I usually don’t want to save any cookies but I do have a few trusted sites where I like to remain logged in. It would be spectacular if I could have some tabs with this privilege and other tabs without, yet avoid breaking the sites that depend on cookies.

    P.S: I have downloaded your patched build and I will test it shortly. I will post my findings to bugzilla and if this works then I will vote for the bug :)

  2. Loune Post author

    Thanks for the support, Monkey. Regarding your question, long term cookies should already be saving in the separate jars. All cookies (session and long term) get saved to the jar you selected for that tab.

    The design of the system is flexible and extensions that have very fine grain cookie filtering/control can be created. You could even have a system where session cookies and long term cookies get directed to different jars for the same tab.

  3. Biton

    Hi Loune

    Thanks for your time spent on developing this. I did a few test using the Oracle Applications forms and unfortunately it wasn’t conclusive.
    My test is follow:
    – login to one environment using Jar A. That opens a java form (Oracle bastardised version of Java)
    – open a new FF window. Log on to same environment using Jar B

    Results: window opened using Jar A gets closed and is replaced by the one in Jar B. This is the same behaviour I get with the non patched version of FF.

    Hope that helps.

  4. Rob Aldred

    Hi mate,
    I can confirm, I have tried your compiled version on windows and it works like a dream!!! Simple but perfect in every way.
    Exactly how it should have been implemented in Firefox right from the beginning.

    Nice work,
    Unfortunately I can’t use it all the time at the moment, because of possible rendering issues in the Firefox 3 code.

    I really hope this makes it into Firefox very very soon.

    Rob

  5. Lukas

    Hi,
    is this project still supported? Do you still developing new versions? I like this feature, but some of my firefox plugins are disabled. What about the possibility to set which jar will be used when opening new tab/new window/etc. ?

Leave a Reply

Your email address will not be published. Required fields are marked *