Closed Bug 831186 Opened 11 years ago Closed 11 years ago

Provide means to use OS.File with file:// URLs

Categories

(Toolkit Graveyard :: OS.File, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 803188

People

(Reporter: asaf, Unassigned)

Details

In the new downloads view, the target file path for a past download is saved by a file:// URL.  This was not an issue when the code used the synchronous nsIFile API: nsIFileProtocolHandler has a method to construct an nsIFile object given a file URI (it seems that the implementation is platform-dependent). 

Later on we switched to the new OS.File API, but we could not get rid of the initial nsIFile object initialization, because OS.File provides no support for file:// URLs.

What do we do? We call nsIFileProtocolHandler::getFileFromURLSpec, and from the this file object we get the path.  I just hope the nsIFile implementations do no perform any I/O operations when they're constructed.

This could be avoided if OS.File provided means to parse file URLs. This is the preferable solution, in my opinion.  However, if the module owners think it doesn't fit, we could, alternatively, add an API to nsIFileProtocolHandler that convert a file URL to the corresponding native path, without the extra step of constructing the nsIFile object.
Severity: normal → enhancement
OS: Mac OS X → All
Hardware: x86 → All
Sounds like a dup of bug 803188. Do you agree?
Happens to everyone!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.