Changeset 67375 in webkit


Ignore:
Timestamp:
Sep 13, 2010 3:15:35 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-09-13 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Don't add empty strings to list of supported image MIME types
https://bugs.webkit.org/show_bug.cgi?id=45643

After <http://trac.webkit.org/changeset/67355> getMIMETypeForExtension()
returns an empty string instead of "application/octet-stream" for unsupported
extensions. Don't add these to the list of supported types, and clean out
the logic that removed "application/octet-stream" from supported types.

Fixes crash in initializeMIMETypeRegistry() due to inserting String() into
a HashSet<String>.

  • platform/MIMETypeRegistry.cpp: (WebCore::initializeSupportedImageMIMETypes): (WebCore::initializeSupportedImageMIMETypesForEncoding):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67373 r67375  
     12010-09-13  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Don't add empty strings to list of supported image MIME types
     6        https://bugs.webkit.org/show_bug.cgi?id=45643
     7
     8        After <http://trac.webkit.org/changeset/67355> getMIMETypeForExtension()
     9        returns an empty string instead of "application/octet-stream" for unsupported
     10        extensions. Don't add these to the list of supported types, and clean out
     11        the logic that removed "application/octet-stream" from supported types.
     12
     13        Fixes crash in initializeMIMETypeRegistry() due to inserting String() into
     14        a HashSet<String>.
     15
     16        * platform/MIMETypeRegistry.cpp:
     17        (WebCore::initializeSupportedImageMIMETypes):
     18        (WebCore::initializeSupportedImageMIMETypesForEncoding):
     19
    1202010-09-13  Adam Barth  <abarth@webkit.org>
    221
  • trunk/WebCore/platform/MIMETypeRegistry.cpp

    r66313 r67375  
    103103#endif
    104104        String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
    105         supportedImageMIMETypes->add(mimeType);
    106         supportedImageResourceMIMETypes->add(mimeType);
    107     }
    108 
    109     supportedImageMIMETypes->remove("application/octet-stream");
    110     supportedImageResourceMIMETypes->remove("application/octet-stream");
     105        if (!mimeType.isEmpty()) {
     106            supportedImageMIMETypes->add(mimeType);
     107            supportedImageResourceMIMETypes->add(mimeType);
     108        }
     109    }
    111110#else
    112111    // assume that all implementations at least support the following standard
     
    153152    for (int i = 0; i < formats.size(); ++i) {
    154153        String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
    155         supportedImageMIMETypesForEncoding->add(mimeType);
    156     }
    157 
    158     supportedImageMIMETypesForEncoding->remove("application/octet-stream");
     154        if (!mimeType.isEmpty())
     155            supportedImageMIMETypesForEncoding->add(mimeType);
     156    }
    159157#elif PLATFORM(GTK)
    160158    supportedImageMIMETypesForEncoding->add("image/png");
Note: See TracChangeset for help on using the changeset viewer.