> So I decided to write a short document about it, and put it up at > http://stud4.tuwien.ac.at/~e0225227/MozillaMIMETypes.html > > Comments welcome. Hopefully, it will be useful to someone.
First, thanks a ton for doing this. Second, we should consider putting this on mozilla.org and linking to it (web developer docs? Mozilla developer docs? Who's the target audience here?). Third, comments on the text: I) Mozilla now has a concept of a "content type hint". The way this works is that you can call SetContentType on a channel prior to calling Open/AsyncOpen and the type you set will be used as a fallback in cases when the server provides no type. For example, the CSSLoader sets the hint to "text/css". This hint is used in preference to using the unknown decoder or looking at the URI, so for example any file:// channel opened from the CSSLoader will end up with a text/css type no matter what the filename is. The hint could conceivably be set for toplevel requests (<a type="foo" href="bar"), but we don't implement that as yet (we hope to soon). II) The URI->type mapping is not solely extension-based: for file:// urls it will call GetTypeFromFile, which does some Internet Config magic on the Mac and could use the MIME metadata for BeOS (someone who has BeOS access should really hack that up....) III) "it is checked whether", not "it is checked if". Better yet, avoid this construct entirely for better readability (I can suggest alternative phrasings if desired). IV) I believe we check for a preferences extension-to-type mapping before we ask the OS. If that's not the case, it's a bug. V) Does any of this code need more documentation as to its intent, in your opinion? It seems to me that the dance around "<?xml" (looking at the URI there) could use some explaining. Anything else like that? VI) The "Helper Applications" section really does feel tacked on... should that be part of a separate document on what happens when Mozilla encounters a type it cannot handle internally? VII) It may be worth saying, in the introduction, that all data handling in Mozilla is based on the MIME type and that therefore the first thing we have to do for data being loaded is to determine its MIME type, no matter what the protocol being used is. Boris -- "Peace is our profession." -- Motto of Strategic Air Command