[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:37:39 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 5cef0f2996c4264016ed5e52f5ceaced490c077c
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 15 22:07:49 2009 +0000

    2009-12-15  Yael Aharon  <yael.aharon at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Cannot load flash files from a local file.
            https://bugs.webkit.org/show_bug.cgi?id=32572
    
            When loading the main resource and its mime type is application/octet-stream,
            use the file extenstion to check if it is a supported plugin.
    
            No new tests were added since any existing swf file can be used as a manual test.
    
            * loader/MainResourceLoader.cpp:
            (WebCore::MainResourceLoader::didReceiveResponse):
            * loader/MainResourceLoader.h:
            * plugins/PluginDatabase.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2a15f6d..db8724f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2009-12-15  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Cannot load flash files from a local file.
+        https://bugs.webkit.org/show_bug.cgi?id=32572
+
+        When loading the main resource and its mime type is application/octet-stream,
+        use the file extenstion to check if it is a supported plugin.
+
+        No new tests were added since any existing swf file can be used as a manual test.
+
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::didReceiveResponse):
+        * loader/MainResourceLoader.h:
+        * plugins/PluginDatabase.h:
+
 2009-12-15  Brian Weinstein  <bweinstein at apple.com>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index c37daef..3e75880 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -38,6 +38,9 @@
 #include "FrameLoaderClient.h"
 #include "HTMLFormElement.h"
 #include "Page.h"
+#if PLATFORM(QT)
+#include "PluginDatabase.h"
+#endif
 #include "ResourceError.h"
 #include "ResourceHandle.h"
 #include "Settings.h"
@@ -279,6 +282,29 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction policy)
     deref(); // balances ref in didReceiveResponse
 }
 
+#if PLATFORM(QT)
+void MainResourceLoader::substituteMIMETypeFromPluginDatabase(const ResourceResponse& r)
+{
+    if (!m_frame->settings()->arePluginsEnabled())
+        return;
+
+    String filename = r.url().lastPathComponent();
+    if (filename.endsWith("/"))
+        return;
+
+    int extensionPos = filename.reverseFind('.');
+    if (extensionPos == -1)
+        return;
+
+    String extension = filename.substring(extensionPos + 1);
+    String mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(extension);
+    if (!mimeType.isEmpty()) {
+        ResourceResponse* response = const_cast<ResourceResponse*>(&r);
+        response->setMimeType(mimeType);
+    }
+}
+#endif
+
 void MainResourceLoader::didReceiveResponse(const ResourceResponse& r)
 {
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
@@ -301,6 +327,11 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r)
     ASSERT(shouldLoadAsEmptyDocument(r.url()) || !defersLoading());
 #endif
 
+#if PLATFORM(QT)
+    if (r.mimeType() == "application/octet-stream")
+        substituteMIMETypeFromPluginDatabase(r);
+#endif
+
     if (m_loadingMultipartContent) {
         frameLoader()->setupForReplaceByMIMEType(r.mimeType());
         clearResourceData();
diff --git a/WebCore/loader/MainResourceLoader.h b/WebCore/loader/MainResourceLoader.h
index 1d5be45..eaaf2e8 100644
--- a/WebCore/loader/MainResourceLoader.h
+++ b/WebCore/loader/MainResourceLoader.h
@@ -92,6 +92,10 @@ namespace WebCore {
         static void callContinueAfterContentPolicy(void*, PolicyAction);
         void continueAfterContentPolicy(PolicyAction);
         void continueAfterContentPolicy(PolicyAction, const ResourceResponse&);
+        
+#if PLATFORM(QT)
+        void substituteMIMETypeFromPluginDatabase(const ResourceResponse&);
+#endif
 
         ResourceRequest m_initialRequest;
         SubstituteData m_substituteData;
diff --git a/WebCore/plugins/PluginDatabase.h b/WebCore/plugins/PluginDatabase.h
index 38bdd93..e134b94 100644
--- a/WebCore/plugins/PluginDatabase.h
+++ b/WebCore/plugins/PluginDatabase.h
@@ -83,6 +83,8 @@ namespace WebCore {
         static Vector<String> defaultPluginDirectories();
         Vector<String> pluginDirectories() const { return m_pluginDirectories; }
 
+        String MIMETypeForExtension(const String& extension) const;
+
     private:
         void getPluginPathsInDirectories(HashSet<String>&) const;
         void getDeletedPlugins(PluginSet&) const;
@@ -91,8 +93,6 @@ namespace WebCore {
         bool add(PassRefPtr<PluginPackage>);
         void remove(PluginPackage*);
 
-        String MIMETypeForExtension(const String& extension) const;
-
         Vector<String> m_pluginDirectories;
         HashSet<String> m_registeredMIMETypes;
         PluginSet m_plugins;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list