Changeset 64430 in webkit


Ignore:
Timestamp:
Jul 31, 2010 5:42:40 PM (14 years ago)
Author:
weinig@apple.com
Message:

Crash due to calling StringImpl::createCFString() from non-main thread in plug-in code
https://bugs.webkit.org/show_bug.cgi?id=43306
<rdar://problem/8259687>

Reviewed by Darin Adler.

  • UIProcess/Plugins/PluginInfoStore.cpp:

(WebKit::PluginInfoStore::getMIMETypeForExtension):
(WebKit::PluginInfoStore::findPlugin):

  • UIProcess/Plugins/PluginInfoStore.h:
  • UIProcess/Plugins/mac/PluginInfoStoreMac.mm:

(WebKit::safeCreateCFString):
(WebKit::PluginInfoStore::getMIMETypeForExtension):
Bypass MIMETypeRegistry in the UIProcess until we can safely convert Strings
to CFStringRefs.

Location:
trunk/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r64426 r64430  
     12010-07-31  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Crash due to calling StringImpl::createCFString() from non-main thread in plug-in code
     6        https://bugs.webkit.org/show_bug.cgi?id=43306
     7        <rdar://problem/8259687>
     8
     9        * UIProcess/Plugins/PluginInfoStore.cpp:
     10        (WebKit::PluginInfoStore::getMIMETypeForExtension):
     11        (WebKit::PluginInfoStore::findPlugin):
     12        * UIProcess/Plugins/PluginInfoStore.h:
     13        * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
     14        (WebKit::safeCreateCFString):
     15        (WebKit::PluginInfoStore::getMIMETypeForExtension):
     16        Bypass MIMETypeRegistry in the UIProcess until we can safely convert Strings
     17        to CFStringRefs.
     18
    1192010-07-31  Sam Weinig  <sam@webkit.org>
    220
  • trunk/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp

    r64287 r64430  
    152152}
    153153
     154#if !PLATFORM(MAC)
     155String PluginInfoStore::getMIMETypeForExtension(const String& extension)
     156{
     157    return MIMETypeRegistry::getMIMETypeForExtension(extension);
     158}
     159#endif
     160
    154161PluginInfoStore::Plugin PluginInfoStore::findPlugin(String& mimeType, const KURL& url)
    155162{
     
    171178       
    172179        // Finally, try to get the MIME type from the extension in a platform specific manner and use that.
    173         String extensionMimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
     180        String extensionMimeType = getMIMETypeForExtension(extension);
    174181        if (!extensionMimeType.isNull()) {
    175182            Plugin plugin = findPluginForMIMEType(extensionMimeType);
  • trunk/WebKit2/UIProcess/Plugins/PluginInfoStore.h

    r64287 r64430  
    7474    static bool getPluginInfo(const WebCore::String& pluginPath, Plugin& plugin);
    7575    static bool shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>& loadedPlugins);
    76    
     76    static WebCore::String getMIMETypeForExtension(const WebCore::String& extension);
     77
    7778    Vector<WebCore::String> m_additionalPluginsDirectories;
    7879    Vector<Plugin> m_plugins;
  • trunk/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm

    r64287 r64430  
    2626#include "PluginInfoStore.h"
    2727
     28#include "WebKitSystemInterface.h"
    2829#include <WebCore/WebCoreNSStringExtras.h>
    2930#include <wtf/HashSet.h>
     
    4647// FIXME: Once the UI process knows the difference between the main thread and the web thread we can drop this and just use
    4748// String::createCFString.
    48 static CFStringRef safeCreateCFString(const String& directory)
    49 {
    50     return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(directory.characters()), directory.length());
     49static CFStringRef safeCreateCFString(const String& string)
     50{
     51    return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(string.characters()), string.length());
    5152}
    5253   
     
    368369}
    369370
     371String PluginInfoStore::getMIMETypeForExtension(const String& extension)
     372{
     373    // FIXME: This should just call MIMETypeRegistry::getMIMETypeForExtension and be
     374    // strength reduced into the callsite once we can safely convert WebCore::String
     375    // to CFStringRef off the main thread.
     376
     377    RetainPtr<CFStringRef> extensionCFString(AdoptCF, safeCreateCFString(extension));
     378    return WKGetMIMETypeForExtension((NSString *)extensionCFString.get());
     379}
     380
    370381} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.