Firefox 2 mac / pc and errant empty navigate/getURL requests

I had a bug that was nagging me for a while, mainly because it only shows up on Mac and XP machines (neither of which i use for development) and i thought i’d share it here since it’ll show up again for someone somewhere.

Here’s the senario:

You’ve coded up an image request/mp3/url to some data of some kind. Server developers are working and in general make lots of edits to your xml data. Sometimes they assume that entering nothing into a url location is a valid way of stopping a url request, but in general i would remove the node altogether rather than enter nulls into valid data areas, since i believe you shouldn’t ship data that is unnessesary to the ui (to optimize the xml data in this case, since it can grow quite large).

For example:
<url></url>

Now, in most browsers this is just fine, but Firefox 2 is special in that it considers an empty html request as valid and attempts to load the root of the current site instead of ignoring the empty request. This will cause further execution of any request to halt and stop the site.

In general, i hate to validate data — data should be prevalidated before it gets sent to the UI (preferably in the initial data entry action) and you should assume in programming a UI that all data is prevalidated, otherwise you end up in spagetti code situations where you are validating data on a per item case, and can build up a huge unnessary mess of code validating each individual field.

A simple rule for server developers: don’t send to the UI what the UI doesn’t need, prevalidate data entry and ensure the database isn’t muddy. Normalization usually will handle this for you but I’ve seen many SQL db’s that are just straight tables so I know it’s unrealistic to expect in all cases.

So, when this kind of thing comes up, check for empty values in url requests.

This entry was posted in Flash. Bookmark the permalink.

Comments are closed.