A site devoted to discussing techniques that promote quality and ethical practices in software development.

Tuesday, May 15, 2007

Ungreyed the OK button in Firefox's download dialog box

Firefox is a great product and I use it wherever a web site does not spill out FF-unfriendly pages.

However, there is a bug in FF (version 2.0.0.3) that calls for some radical way to deal with it. Do not apply this technique to other Windows applications.

In a normal FF, it is set to download to the desktop and that for a file type (more correctly MIME Type) of say PDF, it is set to invoke the viewer automatically. This kind of setting is stored in a file in your Windows profile area under the tree
"Application Data\Mozilla\Firefox\Profiles\[a unique FF profile directory]". For those .Net Programmers, it is kind of like Isolated Storage. FF generates a unique directory name for your FF profile.

In there you will find a file called mimeTypes.rdf.

Now, here are the steps to reproduce the bug. Since this is an experiment and that you may like to restore to the original state, you should take a copy of the file mimeTypes.rdf to a safe place. When you have finished with this experiment, simply overwrite the mimeTypes.rdf with the original copy and you would not know that you have mucked around with FF.

Now open FF and go to the Tools | Options... to bring up the Options dialog box.
  • In the Main section, set the download option to "Always ask me where to save files".
  • In the Content section, click the "Manage..." button for the File Types. You should see a list of types in Download Actions dialog box. Look for PDF type and click on it. The "Remove Action" button is then ungreyed. Click it to delete the PDF from the list.
Now close that dialog box to return to FF. Navigate to a web site where you find a PDF to download.

If you simply click on that link for the PDF, FF will bring up a dialog box asking you what action you would like and it looks like this. If you do not get this, restart FF.


I have actually find this dialog box extremely handy. See the greyed out "OK" button circled in red. According to Mozilla, this is a bug and is caused by some kind of corrupted mimeTypes.rdf file.

Don't be fooled by this greyed button, which in normal Windows UI indicating that it has been disabled. Far from it, in FF-land and is very much alive and kicking.

I do not believe that this is caused by a corrupted mimeTypes.rdf file. I have successfully demonstrated with a brand new installation in an environment that I have manually cleaned up every scrap of Mozilla stuff. By following my steps above, I could reproduce this.

I have further proof that it is most likely a coding or logic bug inside Mozilla's GUI engine in dealing with button and activation process. Here are the ways to ungrey that button to get to that PDF file you want.
  1. The simplest of the lot is alt-tab away from FF and alt-tab back. The greyed OK button now become ungreyed and you can select it.
  2. For those using tablet PC, it can be very inconvenient to perform alt-tab. So tap or click on the greyed OK button (didn't I say radical way before as you would be a fool to do that to a Windows application?) once and it will become ungreyed. A second tap or click on the OK button select the action.
In Windows, if a button is greyed (disabled) your program will not receive any button click message. Hence clicking it will not do anything at all. Since I am not familiar with the internals of FF and in particular its GUI engine, I wouldn't know where the fault actually is.

As demonstrated, it is not random and it can be reproduced consistently. So Mozilla engineer should be able to home in to the trouble.

No comments:

Blog Archive