Closed Bug 785955 Opened 8 years ago Closed 8 years ago

Device Storage - Filter out mimetypes based on device storage type


(Core :: DOM: Device Interfaces, defect)

Not set



blocking-basecamp +


(Reporter: dougt, Assigned: dougt)




(1 file)

Currently, when you enumerate a directory, we return files that shouldn't be returned.  For example, if you ask for a 'pictures' device storage object and in that directory there are files that are not pictures, currently we return those.  What I'd like to do is to filter those files out of the enumeration.

This will be very helpful when we start enumerating the SDCard for Gaia/B2G
Depends on: 783668
Attached patch patch v.1Splinter Review
I'd like to keep the DEBUG_ISTYPE code in for a while.  This will help aide in gaia debugging.
Attachment #655657 - Flags: review?(jonas)
Blocks: 785973
blocking-basecamp: --- → ?
blocking-basecamp: ? → +
Comment on attachment 655657 [details] [diff] [review]
patch v.1

Review of attachment 655657 [details] [diff] [review]:

Let me know what you think about using the properties file instead. I think the current approach would be ok, but we'd need to check that the registry on B2G contains good defaults.

::: dom/devicestorage/nsDeviceStorage.cpp
@@ +150,5 @@
>    return true;
>  }
> +bool
> +DeviceStorageFile::IsType(nsAString& aType)

You'd likely get better results by using the values from the chrome://global/content/ file. I.e. the imageFilter, audioFilter and videoFilter properties there. That's what we're using in the filepicker and has the nice advantage that it doesn't depend on the OS registry and so will produce more consistent results.
Blocks: 786922
Yes, we definitely will have to do that.  I can do that as a followup, if you don't mind.  I filled 786922
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.