Bug 899519 - Use "description" instead of "mime type name" for filter name for accept attribute. r=mounir,bz
authorArnaud Bienner <arnaud.bienner@gmail.com>
Mon, 05 Aug 2013 12:18:08 +0100
changeset 149404 6367c753c7f90671bf88bf613edf8c540468b790
parent 149403 5fd699ed1c557f65264bb33935c0dcedc94c48a2
child 149405 29385afa711f97ac763bc683813d65f7d972a218
push id4254
push userakeybl@mozilla.com
push dateTue, 17 Sep 2013 14:18:33 +0000
treeherdermozilla-aurora@9edd56e694b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir, bz
bugs899519
milestone25.0a1
Bug 899519 - Use "description" instead of "mime type name" for filter name for accept attribute. r=mounir,bz
content/html/content/src/HTMLInputElement.cpp
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -6020,20 +6020,24 @@ HTMLInputElement::SetFilePickerFiltersFr
       if (NS_FAILED(mimeService->GetFromTypeAndExtension(
                       NS_ConvertUTF16toUTF8(token),
                       EmptyCString(), // No extension
                       getter_AddRefs(mimeInfo))) ||
           !mimeInfo) {
         continue;
       }
 
-      // Get mime type name
-      nsCString mimeTypeName;
-      mimeInfo->GetType(mimeTypeName);
-      CopyUTF8toUTF16(mimeTypeName, filterName);
+      // Get a name for the filter: first try the description, then the mime type
+      // name if there is no description
+      mimeInfo->GetDescription(filterName);
+      if (filterName.IsEmpty()) {
+        nsCString mimeTypeName;
+        mimeInfo->GetType(mimeTypeName);
+        CopyUTF8toUTF16(mimeTypeName, filterName);
+      }
 
       // Get extension list
       nsCOMPtr<nsIUTF8StringEnumerator> extensions;
       mimeInfo->GetFileExtensions(getter_AddRefs(extensions));
 
       bool hasMore;
       while (NS_SUCCEEDED(extensions->HasMore(&hasMore)) && hasMore) {
         nsCString extension;