« 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
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