[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 11:37:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 718ee3693979cc7830076d2ce29da100d973d47c
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Aug 1 00:42:40 2010 +0000

    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.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index f086d4d..934d9af 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,23 @@
 2010-07-31  Sam Weinig  <sam at webkit.org>
 
+        Reviewed by Darin Adler.
+
+        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>
+
+        * 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.
+
+2010-07-31  Sam Weinig  <sam at webkit.org>
+
         Reviewed by Dan Bernstein.
 
         Patch for https://bugs.webkit.org/show_bug.cgi?id=43305
diff --git a/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
index 5102acb..4b05aaf 100644
--- a/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
+++ b/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
@@ -151,6 +151,13 @@ static inline String pathExtension(const KURL& url)
     return extension;
 }
 
+#if !PLATFORM(MAC)
+String PluginInfoStore::getMIMETypeForExtension(const String& extension)
+{
+    return MIMETypeRegistry::getMIMETypeForExtension(extension);
+}
+#endif
+
 PluginInfoStore::Plugin PluginInfoStore::findPlugin(String& mimeType, const KURL& url)
 {
     loadPluginsIfNecessary();
@@ -170,7 +177,7 @@ PluginInfoStore::Plugin PluginInfoStore::findPlugin(String& mimeType, const KURL
             return plugin;
         
         // Finally, try to get the MIME type from the extension in a platform specific manner and use that.
-        String extensionMimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
+        String extensionMimeType = getMIMETypeForExtension(extension);
         if (!extensionMimeType.isNull()) {
             Plugin plugin = findPluginForMIMEType(extensionMimeType);
             if (!plugin.path.isNull()) {
diff --git a/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/WebKit2/UIProcess/Plugins/PluginInfoStore.h
index 9ff1f63..d383f2b 100644
--- a/WebKit2/UIProcess/Plugins/PluginInfoStore.h
+++ b/WebKit2/UIProcess/Plugins/PluginInfoStore.h
@@ -73,7 +73,8 @@ private:
     static Vector<WebCore::String> pluginPathsInDirectory(const WebCore::String& directory);
     static bool getPluginInfo(const WebCore::String& pluginPath, Plugin& plugin);
     static bool shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>& loadedPlugins);
-    
+    static WebCore::String getMIMETypeForExtension(const WebCore::String& extension);
+
     Vector<WebCore::String> m_additionalPluginsDirectories;
     Vector<Plugin> m_plugins;
     bool m_pluginListIsUpToDate;
diff --git a/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
index 3110124..64e1103 100644
--- a/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
+++ b/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
@@ -25,6 +25,7 @@
 
 #include "PluginInfoStore.h"
 
+#include "WebKitSystemInterface.h"
 #include <WebCore/WebCoreNSStringExtras.h>
 #include <wtf/HashSet.h>
 #include <wtf/RetainPtr.h>
@@ -45,9 +46,9 @@ Vector<String> PluginInfoStore::pluginsDirectories()
 
 // FIXME: Once the UI process knows the difference between the main thread and the web thread we can drop this and just use
 // String::createCFString.
-static CFStringRef safeCreateCFString(const String& directory)
+static CFStringRef safeCreateCFString(const String& string)
 {
-    return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(directory.characters()), directory.length());
+    return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(string.characters()), string.length());
 }
     
 Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory)
@@ -367,4 +368,14 @@ bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>
     return true;
 }
 
+String PluginInfoStore::getMIMETypeForExtension(const String& extension)
+{
+    // FIXME: This should just call MIMETypeRegistry::getMIMETypeForExtension and be
+    // strength reduced into the callsite once we can safely convert WebCore::String
+    // to CFStringRef off the main thread.
+
+    RetainPtr<CFStringRef> extensionCFString(AdoptCF, safeCreateCFString(extension));
+    return WKGetMIMETypeForExtension((NSString *)extensionCFString.get());
+}
+
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list