Skip to content
  • jonlee@apple.com's avatar
    Crash in PlugInOriginHash with empty MIME type (104882) · e5663dfa
    jonlee@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=104882
    <rdar://problem/12872298>
    
    Reviewed by Filip Pizlo.
    
    The crash occurs because the strings might be null. Add a check for it, but also try to infer a MIME type
    in case the markup does not include a type attribute, but we can find it from the extension in the URL.
    
    * platform/KURL.cpp: Add a new function mimeTypeFromURL() which tries to return the implied MIME type
    based on the URL provided. If nothing was found, return a null string.
    (WebCore::mimeTypeFromURL): Factored out from FrameLoader::defaultObjectContentType().
    * platform/KURL.h:
    
    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::defaultObjectContentType): Refactor to use mimeTypeFromURL().
    * plugins/PlugInOriginHash.cpp:
    (WebCore::addCaseFoldedCharacters): Add a check for an empty string.
    (WebCore::PlugInOriginHash::hash): If the service type is empty, try to infer the MIME type.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e5663dfa