« document.createExpression change between Firefox 2 and Firefox 3 | Main | IE8 And XSS Protection »

June 30, 2008

Extensions and Firefox 3 - nsICookieService Behavior Change

Several users of the Gmail Notifier have reported a bizarre bug that only happens in Firefox 3, and after some digging, I found out it seems nsICookieService has changed its behavior.

I was basically creating sandboxed http requests and storing off the cookies. When the user wants to visit Gmail, I load in the stored off cookies into the browser and load Gmail into a tab. I was using nsICookieService::setCookieString, yet somehow the cookies were not being loaded in Firefox 3.

A user figured out it was because he had Firefox set to not accept 3rd party cookies. It seems in Firefox 3, that preference now affects nsICookieService's behavior when adding new cookies.

nsICookieService::setCookieString does take an optional nsIChannel which would bypass this new restriction, but I need the cookie to be set for the browser in general and not just for one channel.

Enter nsICookieManager2, which has a ::add method. The comments even call it a backdoor method, and it seems to not care about the preference.

So basically, if your extension wants to set browser-wide cookies, the 3rd party acceptance flag (found in preferences under Privacy -> Accept 3rd Party Cookies) may break your extension.

Posted by doron at June 30, 2008 10:43 PM

Trackback Pings

TrackBack URL for this entry:
http://weblogs.mozillazine.org/mt/track.cgi/12702

Listed below are links to weblogs that reference Extensions and Firefox 3 - nsICookieService Behavior Change:

» Buy adipex p 37.5mg no prescription. from Buy adipex p 37.5mg no prescription.
Buy adipex without prescription. Buy adipex without a prescription. [Read More]

Tracked on June 17, 2009 6:15 PM

» Valium. from Valium.
Valium. [Read More]

Tracked on July 10, 2009 4:04 AM

» Adderall. from Adderall.
Adderall side effects. Adderall. Illegal uses for concerta adderall zoloft. [Read More]

Tracked on July 15, 2009 3:14 PM

» Lipitor. from Lipitor.
Lipitor and grapefruits. Side effects from lipitor. Generic version of lipitor. Lipitor. [Read More]

Tracked on July 16, 2009 7:09 AM

» Buy vicodin es on line. from Vicodin es.
Vicodin es. Buy vicodin es on line. Order vicodin es generic. [Read More]

Tracked on July 17, 2009 4:20 AM

» Xanax. from Generic xanax no prescription.
Xanax no prescription. Ijijiji xanax hompage. Xanax addiction. Xanax. Xanax cocktail. [Read More]

Tracked on July 30, 2009 4:38 PM

Comments

See https://bugzilla.mozilla.org/show_bug.cgi?id=437174 which is probably the issue you are hitting

Posted by: Mossop at July 1, 2008 1:08 AM

I believe that this is actually a bug (regression from Firefox 2) and was first noticed when experimental addons could not be installed from AMO if third party cookies were disabled - even though AMO doesn't use third party cookies. It should be fixed for 1.9.0.1 (Firefox 3.0.1) since it's got a regression keyword.

Posted by: Philip Chee at July 1, 2008 12:04 PM

Hey, I want to use the sound notification on a portable firefox. How can I construct a relative path to the sound-file?
Thanks a lot for this extension and sorry if that doesn't quite fit in here.

Posted by: Kolya at July 12, 2008 10:16 AM

Hi Doron,
I have encountered the problem you've talked about, but I didn't have success using the nsICookieManager2::add that you mention.
When I use it, the cookies are not added (unlike when using nsICookieService::setCookieString).

Can u please post a small code snippet which uses nsICookieManager2::add ?
10x alot !

Posted by: Anon. at September 8, 2008 8:37 AM

I have a different problem with my Gmail Notifier and it seems to have to do with my profile. It doesn't log in, it just hangs, and the Log Out menu option is available but grayed out, even though I am not logged in. However, GMail notifier DOES work on the school computers and on another profile I made quickly on this computer to test. So it seems to be my profile. Is there a way to fix this?

Posted by: Matt at October 23, 2008 6:26 PM

Post a comment




Remember Me?