Changeset 52172 in webkit


Ignore:
Timestamp:
Dec 15, 2009 2:07:49 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-15 Yael Aharon <yael.aharon@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:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52170 r52172  
     12009-12-15  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Cannot load flash files from a local file.
     6        https://bugs.webkit.org/show_bug.cgi?id=32572
     7
     8        When loading the main resource and its mime type is application/octet-stream,
     9        use the file extenstion to check if it is a supported plugin.
     10
     11        No new tests were added since any existing swf file can be used as a manual test.
     12
     13        * loader/MainResourceLoader.cpp:
     14        (WebCore::MainResourceLoader::didReceiveResponse):
     15        * loader/MainResourceLoader.h:
     16        * plugins/PluginDatabase.h:
     17
    1182009-12-15  Brian Weinstein  <bweinstein@apple.com>
    219
  • trunk/WebCore/loader/MainResourceLoader.cpp

    r49671 r52172  
    3939#include "HTMLFormElement.h"
    4040#include "Page.h"
     41#if PLATFORM(QT)
     42#include "PluginDatabase.h"
     43#endif
    4144#include "ResourceError.h"
    4245#include "ResourceHandle.h"
     
    280283}
    281284
     285#if PLATFORM(QT)
     286void MainResourceLoader::substituteMIMETypeFromPluginDatabase(const ResourceResponse& r)
     287{
     288    if (!m_frame->settings()->arePluginsEnabled())
     289        return;
     290
     291    String filename = r.url().lastPathComponent();
     292    if (filename.endsWith("/"))
     293        return;
     294
     295    int extensionPos = filename.reverseFind('.');
     296    if (extensionPos == -1)
     297        return;
     298
     299    String extension = filename.substring(extensionPos + 1);
     300    String mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(extension);
     301    if (!mimeType.isEmpty()) {
     302        ResourceResponse* response = const_cast<ResourceResponse*>(&r);
     303        response->setMimeType(mimeType);
     304    }
     305}
     306#endif
     307
    282308void MainResourceLoader::didReceiveResponse(const ResourceResponse& r)
    283309{
     
    302328#endif
    303329
     330#if PLATFORM(QT)
     331    if (r.mimeType() == "application/octet-stream")
     332        substituteMIMETypeFromPluginDatabase(r);
     333#endif
     334
    304335    if (m_loadingMultipartContent) {
    305336        frameLoader()->setupForReplaceByMIMEType(r.mimeType());
  • trunk/WebCore/loader/MainResourceLoader.h

    r50625 r52172  
    9393        void continueAfterContentPolicy(PolicyAction);
    9494        void continueAfterContentPolicy(PolicyAction, const ResourceResponse&);
     95       
     96#if PLATFORM(QT)
     97        void substituteMIMETypeFromPluginDatabase(const ResourceResponse&);
     98#endif
    9599
    96100        ResourceRequest m_initialRequest;
  • trunk/WebCore/plugins/PluginDatabase.h

    r51378 r52172  
    8484        Vector<String> pluginDirectories() const { return m_pluginDirectories; }
    8585
     86        String MIMETypeForExtension(const String& extension) const;
     87
    8688    private:
    8789        void getPluginPathsInDirectories(HashSet<String>&) const;
     
    9193        bool add(PassRefPtr<PluginPackage>);
    9294        void remove(PluginPackage*);
    93 
    94         String MIMETypeForExtension(const String& extension) const;
    9595
    9696        Vector<String> m_pluginDirectories;
Note: See TracChangeset for help on using the changeset viewer.