Open
Bug 136979
Opened 23 years ago
Updated 2 years ago
mimeInfo AppendExtension has no effect.
Categories
(Firefox :: File Handling, defect)
Firefox
File Handling
Tracking
()
NEW
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!
Reporter | ||
Comment 1•23 years ago
|
||
MIMEService.GetTypeFromExtension("rng") also fails.
Comment 2•23 years ago
|
||
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
Comment 3•22 years ago
|
||
So this is "not a bug"? Invalid then.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 4•22 years ago
|
||
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.
Comment 5•22 years ago
|
||
Yeah, Peter is right. We should at least make nsIMIMEDataSource usable or
something....
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 6•22 years ago
|
||
and confirming....
Component: Browser-General → File Handling
Keywords: embed
OS: Windows 2000 → All
QA Contact: imajes-qa → sairuh
Hardware: PC → All
Updated•22 years ago
|
QA Contact: sairuh → petersen
Updated•15 years ago
|
Assignee: law → nobody
QA Contact: chrispetersen → file-handling
Updated•8 years ago
|
Product: Core → Firefox
Version: Trunk → unspecified
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•