mimeTypes.rdf corruption

This page explains a problem that can cause SVG to stop working in Mozilla due to the way Mozilla maps filename extensions to media types.


Previously you were able to open and display SVG content with Mozilla, but for no apparent reason its behavior changes and now it always pops up the "Open or Save File" dialog when you try to open local SVG files, and displays the "Additional plugins are required to display all the media on this page" bar when you try to view HTML with embedded SVG.

Note: the "Additional plugins are required" bar can appear for legitimate reasons when the SVG or its embedding HTML is broken or served incorrectly over the network (see the SVG FAQ). If the blue square with the white cross displays when you load this scripting across embed demo, then you are not experiencing this problem. If it doesn't, then you almost certainly are.


Mozilla decides if and how it can open files by using their media (MIME) type. It obtains the media type for files in various ways. For files loaded over the network via HTTP, it requires and uses the value assigned to the Content-type HTTP header. For files loaded locally, it first looks in a cache of filename extension to media type mappings (stored in a Mozilla profile file called mimeTypes.rdf), and if it doesn't find a media type there, it asks the operating system.

Actually, in Mozilla Firefox 1.5, the media type for files embedded into HTML using the HTML <embed> and <object> tags is (unfortunately) obtained in the same way as it's obtained for local files instead of using the HTTP headers as it should. This bug has been fixed in trunk builds.

Problems in the way Mozilla obtains the media type for files loaded locally can occur in two ways. First, certain actions can cause the media types cache in mimeTypes.rdf to associate a filename extension with the wrong media type. Second, certain actions may cause the OS to associate a filename extension with the wrong media type. If either of these things happen, then Mozilla can end up with a media type for files that it doesn't recognize, but which the user knows it should.

Actions that Trigger this Bug


Possible Solutions

How you solve this problem depends on whether it's your operating system or your Mozilla profile (mimeTypes.rdf) that are corrupt. The latter is more common, so we'll start with that. However, it seems that the former may also cause the latter. One way to check is to create a new profile and restart Mozilla using that profile. If SVG works with the new profile, then delete the new profile and go about cleaning your old profile using the steps in the section below. If the new profile doesn't work, clean your OS file associations, then your mimeTypes.rdf.

Create and Remove a Bogus File Association

This solution should work for mimeTypes.rdf corruption, and requires little technical knowledge. It's adapted from JP Fiset's comment in bug 303581 which in turn was adapted from Jeff Schiller's comment in bug 303581.

1. Try and open a local .svg file using Mozilla and when the "Opening ..." dialog comes up, select the "Open with" radio button and choose any .exe except firefox.exe/mozilla.exe.

2. Make sure the "Do this automatically for files like this from now on" checkbox is checked.

3. Click OK, and when the program you chose tries to open the file, just close it.

4. In Firefox, go to Tools > Options... > Downloads > View & Edit Actions... to open the Download Actions window.

5. Select the SVG entry, click the Remove Action button and then click Close to close the Download Actions window.

6. Try and load a local .svg file and this scripting across embed demo.

If the files you attempt to load in step 6 work, then your problem was mimeTypes.rdf corruption. If they still don't work, then you operating system is the likely culprit.

Fix for OS file associations

Your OS may be associating the wrong media type with the .svg filename extension if you have installed an old program such as Photoshop Elements 1.0 and chose to install the *very* old Adobe SVG Viewer that comes bundled with it. This will set up the OS to associate the .svg filename extension with the incorrect media type "image/svg-xml" instead of "image/svg+xml".

Microsoft Windows

One way to fix this in Microsoft Windows is to start RegEdit (Start > Run > regedit) and search for "svg". Change every occurrence of "image/svg-xml" (or whatever the invalid media type is) to "image/svg+xml".

Normally, this matters just for the entry "HKEY_CLASSES_ROOT\.svg\Content Type".

After correcting the OS file associations you will probably need to re-clean your mimeTypes.rdf as described in the section above.

Fixing the Bug

Need to look at the exthandler code.

Related bugs: bug 332690 and bug 303581.