I just installed beta 4 of FireFox 3.0 and checked a few of my application that use AJAX to make sure if things would still work properly. Specifically I ran through samples for the Data Resource provider front end which uses extensive AJAX callbacks to display data and incremental UI. And I noticed that this code simply didn't work - all the callbacks to the server end up failing with the server complaining about a missing POST variable that is actually being sent from the client. Checked with all other browsers I have installed (FireFox 2, IE 7/8, Safari and Opera) and they all works fine, but only FireFox 3.0 chokes on this code.
After some investigation I found the problem in my JsonCallbackMethodProcessor code in the West Wind Ajax Toolkit, which is maybe a bit brittle:
else if (contentType == STR_UrlEncodedContentType && Request.Params["CallbackMethod"] != null)
public const string STR_UrlEncodedContentType = "application/x-www-form-urlencoded";
This has always worked as a check for seeing if content is URL encoded, but FireFox 3.0 adds an explicit character set to the content-type string:
POST /wwHoverpanel/SimpleMethodCallbacks.aspx HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:220.127.116.11; .NET CLR 2.0.50727) Gecko/20071127 Firefox/18.104.22.168
Pragma: no-cache, no-cache
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
The additional character set of course breaks the above code and so all callbacks are broken. Easy thing to miss, but it's probably a good idea in general when looking for content types to use .StartsWith() or explicitly strip out the character set with RegEx to pick up the content type only.
else if (contentType.StartsWith( STR_UrlEncodedContentType ) && Request.Params["CallbackMethod"] != null)
There are a few other places where this needed to be adjusted as well - the JsonCallbackProcessor also accepts MS Ajax styled wrapped and raw JSON objects (as long as a matching parameter type signature is available) and these two are causing problems in FireFox for the same reason at least in my code.
I've fixed this bug in the West Wind AJAX Toolkit and it's been updated online. Fixed, but this code is running in a ton of apps on my site so it'll take a bit of time to get funnelled into all nooks and crannies.
The last few days I've been hunting down a few other small bugs in my client libraries related to IE 8 and FireFox 3.0 changes. IE 8 is a lot more finicky when using style properties in code and I've had a number of style.property code fail on me where the code used to run fine in IE 7 and all other main browsers. Most of these are minor formatting issues or auto type conversions that used to work. Most of these are very minor and - hust, hust - they're really sloppy code on my part and should have been changed in the first place rather than a problem in IE 8 stricter rendering and interpretation of CSS. All of this (that I've been able to track down so far) has been fixed.
Other Posts you might also like