March 2008 | Main | July 2008

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 10:43 PM | Comments (5) | TrackBack

June 24, 2008

document.createExpression change between Firefox 2 and Firefox 3

Ran into this with an IBM product I am working on:

In Firefox 3 (Gecko 1.9), there seems to have been a change that affects XPath and document.createExpression. In particular, you now have to call createExpression on the document you will run the XPath against. Before, you could call createExpression on another document.

In Firefox 2, the following would work:
    var expr = document.createExpression(...);
    expr.evaluate(anotherDocument, ...)

In Firefox 3, you will get:
    Node cannot be used in a document other than the one in which it was created" code: "4

Example showing this: http://nexgenmedia.net/mozilla/playgroundxpath.html

Hopefully this will save people time when running into this.

Posted by doron at 9:34 AM | Comments (3) | TrackBack

June 16, 2008

SproutCore Is Crap

Loads in Firefox 2, but if I use Seamonkey or Minefield, I get nothing.

I thought everyone agreed user-agent sniffing was bad back at the start of the century...

Posted by doron at 6:03 PM | Comments (1) | TrackBack