Open Bug 136979 Opened 23 years ago Updated 2 years ago

mimeInfo AppendExtension has no effect.

Categories

(Firefox :: File Handling, defect)

defect

Tracking

()

People

(Reporter: pwilson, Unassigned)

References

Details

(Keywords: embed)

Build 2002040911 Windows 2000 The following code should allow you to add a new file extension for a known MIME type: var MIMEService = Components.classes["@mozilla.org/mime;1"]. getService(Components.interfaces.nsIMIMEService); var mimeInfo = MIMEService.GetFromMIMEType("text/xml"); if (!mimeInfo) alert("no mime info"); alert("primary:" + mimeInfo.primaryExtension); // Just Checking mimeInfo.AppendExtension("rng"); alert("EE:" + mimeInfo.ExtensionExists("rng")); try { alert("TFE:" + MIMEService.GetFromExtension("rng")); } catch (e) {alert("GetTypeFromExtension failed.")} I get: "primary:xml" Good "EE:true" Very Good "GetTypeFromExtension failed." Not so good. Aside: The MimeInfo returned is defective for debugging - any attempt to look at it (or execute a defined interface function) in Venkman crashes the browser (null pointer reference). Without this functionality it is impossible to use the document.load method for and local xml file with an unknown extension. Major bummer!
MIMEService.GetTypeFromExtension("rng") also fails.
The mime info returned by the mime service should not propagate changes to it back to the mime service... if you really want to add a new mapping, you have to do it via mimeTypes.rdf; the mime service does not provide this functionality.
Assignee: Matti → law
So this is "not a bug"? Invalid then.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You have ducked the issue. How do you add a new mime type mapping at runtime? The Mime Service should provide this functionality. Having programmers hack the rdf files is not a solution. Judging by the number of postings on "How do I associate a local file with a particular mime type" this is not a obscure issue.
Yeah, Peter is right. We should at least make nsIMIMEDataSource usable or something....
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
and confirming....
Component: Browser-General → File Handling
Keywords: embed
OS: Windows 2000 → All
QA Contact: imajes-qa → sairuh
Hardware: PC → All
confirming.
Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: sairuh → petersen
Depends on: 190413
Assignee: law → nobody
QA Contact: chrispetersen → file-handling
Product: Core → Firefox
Version: Trunk → unspecified
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.